r7792: make the allocation size rounding in pvfs configurable
authorAndrew Tridgell <tridge@samba.org>
Tue, 21 Jun 2005 04:23:05 +0000 (04:23 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:36 +0000 (13:18 -0500)
(This used to be commit 1f35642bed1129d0834906b3e94e8868992d6eb9)

source4/ntvfs/posix/pvfs_util.c
source4/ntvfs/posix/vfs_posix.c
source4/ntvfs/posix/vfs_posix.h

index d716834fed235fa6679169c6a1b40bc939102756..f286dfdc48c8acbd5e4e8f39fdafda8c7f436fda 100644 (file)
@@ -198,7 +198,6 @@ uint32_t pvfs_name_hash(const char *key, size_t length)
 */
 uint64_t pvfs_round_alloc_size(struct pvfs_state *pvfs, uint64_t size)
 {
-       const uint64_t round_value = 511;
-       if (size == 0) return 0;
-       return (size + round_value) & ~round_value;
+       const uint32_t round_value = pvfs->alloc_size_rounding;
+       return round_value * ((size + round_value - 1)/round_value);
 }
index 846ba61a861a2b4802fc8617233655c1bd05acf5..906428fc6dfb77c6d6c031f1664d67df4715647c 100644 (file)
@@ -51,6 +51,9 @@ static void pvfs_setup_options(struct pvfs_state *pvfs)
                pvfs->flags |= PVFS_FLAG_FAKE_OPLOCKS;
        }
 
+       /* this must be a power of 2 */
+       pvfs->alloc_size_rounding = lp_parm_int(-1, "posix", "allocationrounding", 512);
+
 #if HAVE_XATTR_SUPPORT
        if (lp_parm_bool(snum, "posix", "xattr", True)) pvfs->flags |= PVFS_FLAG_XATTR_ENABLE;
 #endif
index a55674d69a2d9fd0f96b483fea57d1e9e077eca4..b5b0e2b28dd6544321cbfcbd54c68168544ac32b 100644 (file)
@@ -72,6 +72,9 @@ struct pvfs_state {
        /* if posix:eadb is set, then this gets setup */
        struct tdb_wrap *ea_db;
 
+       /* the allocation size rounding */
+       uint32_t alloc_size_rounding;
+       
        /* used to accelerate acl mapping */
        struct {
                const struct dom_sid *creator_owner;