s3:vfs:syncops add option to disable metasync per share
authorChristian Ambach <christian.ambach@de.ibm.com>
Fri, 18 Feb 2011 12:03:52 +0000 (13:03 +0100)
committerVolker Lendecke <vlendec@samba.org>
Fri, 18 Feb 2011 16:31:59 +0000 (17:31 +0100)
introduce an option to disable the metadata sync
in case the filesystem handles this correctly the sync can be
skipped, but synchronization of the data that was written can still
be configured (in opposition to the disable flag disabling all
sync operations)

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Feb 18 17:31:59 CET 2011 on sn-devel-104

source3/modules/vfs_syncops.c

index 2b7c2a34dac343cc95b731dacab732d4b37b3758..76072abc3308e92398b5a41b5cdd1ddb115498d1 100644 (file)
@@ -2,6 +2,7 @@
  * ensure meta data operations are performed synchronously
  *
  * Copyright (C) Andrew Tridgell     2007
+ * Copyright (C) Christian Ambach, 2010-2011
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
      syncops:onclose = no
   that can be set either globally or per share.
 
-  you can also disable the module completely for a service with
+  On certain filesystems that only require the last data written to be
+  fsync()'ed, you can disable the metadata synchronization of this module with
+     syncops:onmeta = no
+  This option can be set either globally or per share.
+
+  you can also disable the module completely for a share with
      syncops:disable = true
 
  */
 
 struct syncops_config_data {
        bool onclose;
+       bool onmeta;
        bool disable;
 };
 
@@ -142,7 +149,7 @@ static int syncops_rename(vfs_handle_struct *handle,
                                return -1);
 
        ret = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
-       if (ret == 0 && !config->disable) {
+       if (ret == 0 && config->onmeta && !config->disable) {
                syncops_two_names(smb_fname_src->base_name,
                                  smb_fname_dst->base_name);
        }
@@ -158,7 +165,7 @@ static int syncops_rename(vfs_handle_struct *handle,
                                return -1); \
        ret = SMB_VFS_NEXT_ ## op args; \
        if (ret == 0 \
-               && !config->disable \
+               && config->onmeta && !config->disable  \
                && fname) syncops_name(fname); \
        return ret; \
 } while (0)
@@ -171,7 +178,7 @@ static int syncops_rename(vfs_handle_struct *handle,
                                return -1); \
        ret = SMB_VFS_NEXT_ ## op args; \
        if (ret == 0 \
-       && !config->disable \
+       && config->onmeta && !config->disable \
        && fname) syncops_smb_fname(fname); \
        return ret; \
 } while (0)
@@ -255,6 +262,9 @@ int syncops_connect(struct vfs_handle_struct *handle, const char *service,
        config->onclose = lp_parm_bool(SNUM(handle->conn), "syncops",
                                        "onclose", true);
 
+       config->onmeta = lp_parm_bool(SNUM(handle->conn), "syncops",
+                                       "onmeta", true);
+
        config->disable = lp_parm_bool(SNUM(handle->conn), "syncops",
                                        "disable", false);