s3:vfs:gpfs convert syncio parameter
authorChristian Ambach <ambi@samba.org>
Thu, 24 Nov 2011 12:39:01 +0000 (13:39 +0100)
committerChristian Ambach <ambi@samba.org>
Thu, 24 Nov 2011 14:52:09 +0000 (15:52 +0100)
convert syncio parameter to be stored in the VFS handle data
this removes the need to go through lp_parm_bool() on each open

source3/modules/vfs_gpfs.c

index 0a684e0d8e5df2edcc9e9f6381a3edab07ef8360..9d09777cad9cc0a8733c73975a5469c318bf5372 100644 (file)
@@ -38,6 +38,7 @@ struct gpfs_config_data {
        bool sharemodes;
        bool leases;
        bool hsm;
+       bool syncio;
 };
 
 
@@ -1275,6 +1276,9 @@ int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
        config->hsm = lp_parm_bool(SNUM(handle->conn), "gpfs",
                                   "hsm", false);
 
+       config->syncio = lp_parm_bool(SNUM(handle->conn), "gpfs",
+                                     "syncio", false);
+
        SMB_VFS_HANDLE_SET_DATA(handle, config,
                                NULL, struct gpfs_config_data,
                                return -1);
@@ -1304,8 +1308,13 @@ static int vfs_gpfs_open(struct vfs_handle_struct *handle,
                         struct smb_filename *smb_fname, files_struct *fsp,
                         int flags, mode_t mode)
 {
-       if (lp_parm_bool(fsp->conn->params->service, "gpfs", "syncio",
-                        false)) {
+       struct gpfs_config_data *config;
+
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct gpfs_config_data,
+                               return -1);
+
+       if (config->syncio) {
                flags |= O_SYNC;
        }
        return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);