From ab0359a19986f744075bf861dd43626210c2ecf7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 8 Jan 2009 10:55:28 -0800 Subject: [PATCH] Remove "strict allocate = partial" code that got accidentally committed. Jeremy. --- source/include/local.h | 4 ---- source/include/smb.h | 6 ------ source/modules/vfs_default.c | 6 +----- source/param/loadparm.c | 27 ++++++--------------------- source/smbd/fileio.c | 5 ++--- source/smbd/vfs.c | 13 ++----------- 6 files changed, 11 insertions(+), 50 deletions(-) diff --git a/source/include/local.h b/source/include/local.h index b0fd7cb5b6f..c125ded3713 100644 --- a/source/include/local.h +++ b/source/include/local.h @@ -253,8 +253,4 @@ /* Windows minimum lock resolution timeout in ms */ #define WINDOWS_MINIMUM_LOCK_TIMEOUT_MS 200 -/* When strict allocate = partial, define the limit on how far - * ahead we will write. */ -#define STRICT_ALLOCATE_PARTIAL_LIMIT 0x200000 - #endif diff --git a/source/include/smb.h b/source/include/smb.h index 2aa708a404a..e248164043f 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -1966,10 +1966,4 @@ struct smb_extended_info { char samba_version_string[SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH]; }; -enum smb_strict_allocate_options { - STRICT_ALLOCATE_OFF=0, - STRICT_ALLOCATE_ON=1, - STRICT_ALLOCATE_PARTIAL=2 -}; - #endif /* _SMB_H */ diff --git a/source/modules/vfs_default.c b/source/modules/vfs_default.c index ff8e19a271e..2da97f1a0d6 100644 --- a/source/modules/vfs_default.c +++ b/source/modules/vfs_default.c @@ -759,14 +759,10 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O SMB_STRUCT_STAT st; char c = 0; SMB_OFF_T currpos; - enum smb_strict_allocate_options sa_options = lp_strict_allocate(SNUM(fsp->conn)); START_PROFILE(syscall_ftruncate); - /* Only use allocation truncate if strict allocate - * is set "on", not off or partial. - */ - if (sa_options == STRICT_ALLOCATE_ON) { + if (lp_strict_allocate(SNUM(fsp->conn))) { result = strict_allocate_ftruncate(handle, fsp, len); END_PROFILE(syscall_ftruncate); return result; diff --git a/source/param/loadparm.c b/source/param/loadparm.c index 456bc740e79..aa41bf96156 100644 --- a/source/param/loadparm.c +++ b/source/param/loadparm.c @@ -445,7 +445,7 @@ struct service { bool bWidelinks; bool bSymlinks; bool bSyncAlways; - int iStrictAllocate; + bool bStrictAllocate; bool bStrictSync; char magic_char; struct bitmap *copymap; @@ -588,7 +588,7 @@ static struct service sDefault = { True, /* bWidelinks */ True, /* bSymlinks */ False, /* bSyncAlways */ - STRICT_ALLOCATE_OFF, /* iStrictAllocate */ + False, /* bStrictAllocate */ False, /* bStrictSync */ '~', /* magic char */ NULL, /* copymap */ @@ -861,21 +861,6 @@ static const struct enum_list enum_config_backend[] = { {-1, NULL} }; -static const struct enum_list enum_strict_allocate[] = { - {STRICT_ALLOCATE_OFF, "No"}, - {STRICT_ALLOCATE_OFF, "False"}, - {STRICT_ALLOCATE_OFF, "0"}, - {STRICT_ALLOCATE_OFF, "Off"}, - {STRICT_ALLOCATE_OFF, "disabled"}, - {STRICT_ALLOCATE_ON, "Yes"}, - {STRICT_ALLOCATE_ON, "True"}, - {STRICT_ALLOCATE_ON, "1"}, - {STRICT_ALLOCATE_ON, "On"}, - {STRICT_ALLOCATE_ON, "enabled"}, - {STRICT_ALLOCATE_PARTIAL, "partial"}, - {-1, NULL} -}; - /* Note: We do not initialise the defaults union - it is not allowed in ANSI C * * The FLAG_HIDE is explicit. Paramters set this way do NOT appear in any edit @@ -2409,11 +2394,11 @@ static struct parm_struct parm_table[] = { }, { .label = "strict allocate", - .type = P_ENUM, + .type = P_BOOL, .p_class = P_LOCAL, - .ptr = &sDefault.iStrictAllocate, + .ptr = &sDefault.bStrictAllocate, .special = NULL, - .enum_list = enum_strict_allocate, + .enum_list = NULL, .flags = FLAG_ADVANCED | FLAG_SHARE, }, { @@ -5289,7 +5274,7 @@ FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames) FN_LOCAL_BOOL(lp_widelinks, bWidelinks) FN_LOCAL_BOOL(lp_symlinks, bSymlinks) FN_LOCAL_BOOL(lp_syncalways, bSyncAlways) -FN_LOCAL_INTEGER(lp_strict_allocate, iStrictAllocate) +FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate) FN_LOCAL_BOOL(lp_strict_sync, bStrictSync) FN_LOCAL_BOOL(lp_map_system, bMap_system) FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly) diff --git a/source/smbd/fileio.c b/source/smbd/fileio.c index e23f391de7a..60aeeef1e24 100644 --- a/source/smbd/fileio.c +++ b/source/smbd/fileio.c @@ -127,10 +127,9 @@ static ssize_t real_write_file(struct smb_request *req, if (pos == -1) { ret = vfs_write_data(req, fsp, data, n); } else { - enum smb_strict_allocate_options sa_options = lp_strict_allocate(SNUM(fsp->conn)); fsp->fh->pos = pos; - if (pos && (sa_options != STRICT_ALLOCATE_OFF)) { - if (vfs_fill_sparse(fsp, pos, sa_options) == -1) { + if (pos && lp_strict_allocate(SNUM(fsp->conn))) { + if (vfs_fill_sparse(fsp, pos) == -1) { return -1; } } diff --git a/source/smbd/vfs.c b/source/smbd/vfs.c index e8c0ebb50f1..6cf156cb390 100644 --- a/source/smbd/vfs.c +++ b/source/smbd/vfs.c @@ -545,9 +545,8 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len) /* Grow - we need to test if we have enough space. */ - if (lp_strict_allocate(SNUM(fsp->conn)) == STRICT_ALLOCATE_OFF) { + if (!lp_strict_allocate(SNUM(fsp->conn))) return 0; - } len -= st.st_size; len /= 1024; /* Len is now number of 1k blocks needed. */ @@ -601,7 +600,7 @@ int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len) static char *sparse_buf; #define SPARSE_BUF_WRITE_SIZE (32*1024) -int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len, enum smb_strict_allocate_options sa_options) +int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len) { int ret; SMB_STRUCT_STAT st; @@ -620,14 +619,6 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len, enum smb_strict_allocate_o return 0; } - /* If strict allocate is set to "partial", ignore all allocate - * retquests over the STRICT_ALLOCATE_PARTIAL_LIMIT. */ - - if ((sa_options == STRICT_ALLOCATE_PARTIAL) && - (len - st.st_size > STRICT_ALLOCATE_PARTIAL_LIMIT)) { - return 0; - } - DEBUG(10,("vfs_fill_sparse: write zeros in file %s from len %.0f to len %.0f (%.0f bytes)\n", fsp->fsp_name, (double)st.st_size, (double)len, (double)(len - st.st_size))); -- 2.11.4.GIT