Changeset 745 for trunk/server/source3/modules/vfs_syncops.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
source3/modules/vfs_syncops.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/modules/vfs_syncops.c
r414 r745 3 3 * 4 4 * Copyright (C) Andrew Tridgell 2007 5 5 6 * 6 7 * This program is free software; you can redistribute it and/or modify … … 20 21 21 22 #include "includes.h" 23 24 22 25 23 26 /* … … 32 35 On those filesystems this module provides a way to perform those 33 36 operations safely. 34 */ 35 36 /* 37 37 38 most of the performance loss with this module is in fsync on close(). 38 You can disable that with syncops:onclose = no 39 */ 40 static bool sync_onclose; 39 You can disable that with 40 syncops:onclose = no 41 that can be set either globally or per share. 42 43 On certain filesystems that only require the last data written to be 44 fsync()'ed, you can disable the metadata synchronization of this module with 45 syncops:onmeta = no 46 This option can be set either globally or per share. 47 48 you can also disable the module completely for a share with 49 syncops:disable = true 50 51 */ 52 53 struct syncops_config_data { 54 bool onclose; 55 bool onmeta; 56 bool disable; 57 }; 41 58 42 59 /* … … 126 143 const struct smb_filename *smb_fname_dst) 127 144 { 128 int ret = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst); 129 if (ret == 0) { 145 146 int ret; 147 struct syncops_config_data *config; 148 149 SMB_VFS_HANDLE_GET_DATA(handle, config, 150 struct syncops_config_data, 151 return -1); 152 153 ret = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst); 154 if (ret == 0 && config->onmeta && !config->disable) { 130 155 syncops_two_names(smb_fname_src->base_name, 131 156 smb_fname_dst->base_name); … … 136 161 /* handle the rest with a macro */ 137 162 #define SYNCOPS_NEXT(op, fname, args) do { \ 138 int ret = SMB_VFS_NEXT_ ## op args; \ 139 if (ret == 0 && fname) syncops_name(fname); \ 163 int ret; \ 164 struct syncops_config_data *config; \ 165 SMB_VFS_HANDLE_GET_DATA(handle, config, \ 166 struct syncops_config_data, \ 167 return -1); \ 168 ret = SMB_VFS_NEXT_ ## op args; \ 169 if (ret == 0 \ 170 && config->onmeta && !config->disable \ 171 && fname) syncops_name(fname); \ 140 172 return ret; \ 141 173 } while (0) 142 174 143 175 #define SYNCOPS_NEXT_SMB_FNAME(op, fname, args) do { \ 144 int ret = SMB_VFS_NEXT_ ## op args; \ 145 if (ret == 0 && fname) syncops_smb_fname(fname); \ 176 int ret; \ 177 struct syncops_config_data *config; \ 178 SMB_VFS_HANDLE_GET_DATA(handle, config, \ 179 struct syncops_config_data, \ 180 return -1); \ 181 ret = SMB_VFS_NEXT_ ## op args; \ 182 if (ret == 0 \ 183 && config->onmeta && !config->disable \ 184 && fname) syncops_smb_fname(fname); \ 146 185 return ret; \ 147 186 } while (0) … … 192 231 static int syncops_close(vfs_handle_struct *handle, files_struct *fsp) 193 232 { 194 if (fsp->can_write && sync_onclose) { 233 struct syncops_config_data *config; 234 235 SMB_VFS_HANDLE_GET_DATA(handle, config, 236 struct syncops_config_data, 237 return -1); 238 239 if (fsp->can_write && config->onclose) { 195 240 /* ideally we'd only do this if we have written some 196 241 data, but there is no flag for that in fsp yet. */ … … 200 245 } 201 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 202 280 203 281 static struct vfs_fn_pointers vfs_syncops_fns = { 282 204 283 .mkdir = syncops_mkdir, 205 284 .rmdir = syncops_rmdir, 206 .open = syncops_open,285 .open = syncops_open, 207 286 .rename = syncops_rename, 208 287 .unlink = syncops_unlink, … … 223 302 return ret; 224 303 225 sync_onclose = lp_parm_bool(-1, "syncops", "onclose", true);226 227 304 return ret; 228 305 }
Note:
See TracChangeset
for help on using the changeset viewer.
