[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Sat Dec 17 11:59:02 UTC 2016


The branch, master has been updated
       via  e717ca6 vfs_gpfs: simplify stat_with_capability() ifdef
       via  2e8cdda vfs_gpfs: remove updating btime from stat VFS calls
       via  adf4cea vfs_gpfs: update btime in vfs_gpfs_(f)get_dos_attributes
      from  1227065 idmap_autorid: Simplify idmap_autorid_loadconfig

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e717ca65cfb3d8fee28f3ccc1e96d765f637642d
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 15 18:10:22 2016 +0100

    vfs_gpfs: simplify stat_with_capability() ifdef
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Sat Dec 17 12:58:07 CET 2016 on sn-devel-144

commit 2e8cdda78774d5ecd1b4c4e2e11edf3e0829b3b4
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Nov 28 12:22:04 2016 +0100

    vfs_gpfs: remove updating btime from stat VFS calls
    
    This is now handled by the vfs_gpfs_(f)get_dos_attributes. Getting rid
    of this in the stat VFS functions is a huge performance saver. perf
    report found that in a kernel copy workload smbd was spending
    considerable CPU time in vfs_gpfs_(f|l)stat -> gpfs_get_winattrs.
    
    Most of the time the VFS stat caller is not interested in the btime. The
    SMB frontend processing around btime is designed to fetch btime together
    with DOS attributes via dos_mode() in all places that need these
    attributes. That's the way it is implemented in the default VFS module
    and that's what vfs_gpfs now does as well for performance reasons.
    
    This makes vfs_gpfs_fstat a null op and I'm therefor removing it.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

commit adf4cea1db46f2898540c041003da5b4bd447f80
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 15 07:09:58 2016 +0100

    vfs_gpfs: update btime in vfs_gpfs_(f)get_dos_attributes
    
    This paves the way for removing btime updates from the stat VFS
    functions.
    
    This way we behave like the default VFS module where DOS attributes and
    btime are fetched from the same backing store and the frontend is
    designed around using dos_mode() -> SMB_VFS_GET_ATTRIBUTES to update
    both attributes as necessary in the SMB processing.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_gpfs.c | 98 ++++++----------------------------------------
 1 file changed, 12 insertions(+), 86 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 89ce3b7..f7434c9 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1565,6 +1565,9 @@ static NTSTATUS vfs_gpfs_get_dos_attributes(struct vfs_handle_struct *handle,
 	}
 
 	*dosmode |= vfs_gpfs_winattrs_to_dosmode(attrs.winAttrs);
+	smb_fname->st.st_ex_calculated_birthtime = false;
+	smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
+	smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
 
 	return NT_STATUS_OK;
 }
@@ -1597,6 +1600,9 @@ static NTSTATUS vfs_gpfs_fget_dos_attributes(struct vfs_handle_struct *handle,
 	}
 
 	*dosmode |= vfs_gpfs_winattrs_to_dosmode(attrs.winAttrs);
+	fsp->fsp_name->st.st_ex_calculated_birthtime = false;
+	fsp->fsp_name->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
+	fsp->fsp_name->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
 
 	return NT_STATUS_OK;
 }
@@ -1669,10 +1675,10 @@ static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
 	return NT_STATUS_OK;
 }
 
-#if defined(HAVE_FSTATAT)
 static int stat_with_capability(struct vfs_handle_struct *handle,
 				struct smb_filename *smb_fname, int flag)
 {
+#if defined(HAVE_FSTATAT)
 	int fd = -1;
 	bool b;
 	char *dir_name;
@@ -1706,15 +1712,14 @@ static int stat_with_capability(struct vfs_handle_struct *handle,
 	}
 
 	return ret;
-}
+#else
+	return -1;
 #endif
+}
 
 static int vfs_gpfs_stat(struct vfs_handle_struct *handle,
 			 struct smb_filename *smb_fname)
 {
-	struct gpfs_winattr attrs;
-	char *fname = NULL;
-	NTSTATUS status;
 	int ret;
 	struct gpfs_config_data *config;
 
@@ -1723,73 +1728,17 @@ static int vfs_gpfs_stat(struct vfs_handle_struct *handle,
 				return -1);
 
 	ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
-#if defined(HAVE_FSTATAT)
 	if (ret == -1 && errno == EACCES) {
 		DEBUG(10, ("Trying stat with capability for %s\n",
 			   smb_fname->base_name));
 		ret = stat_with_capability(handle, smb_fname, 0);
 	}
-#endif
-	if (ret == -1) {
-		return -1;
-	}
-
-	if (!config->winattr) {
-		return 0;
-	}
-
-	status = get_full_smb_filename(talloc_tos(), smb_fname, &fname);
-	if (!NT_STATUS_IS_OK(status)) {
-		errno = map_errno_from_nt_status(status);
-		return -1;
-	}
-	ret = gpfswrap_get_winattrs_path(discard_const_p(char, fname), &attrs);
-	TALLOC_FREE(fname);
-	if (ret == 0) {
-		smb_fname->st.st_ex_calculated_birthtime = false;
-		smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
-		smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
-	}
-	return 0;
-}
-
-static int vfs_gpfs_fstat(struct vfs_handle_struct *handle,
-			  struct files_struct *fsp, SMB_STRUCT_STAT *sbuf)
-{
-	struct gpfs_winattr attrs;
-	int ret;
-	struct gpfs_config_data *config;
-
-	SMB_VFS_HANDLE_GET_DATA(handle, config,
-				struct gpfs_config_data,
-				return -1);
-
-	ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
-	if (ret == -1) {
-		return -1;
-	}
-	if ((fsp->fh == NULL) || (fsp->fh->fd == -1)) {
-		return 0;
-	}
-	if (!config->winattr) {
-		return 0;
-	}
-
-	ret = gpfswrap_get_winattrs(fsp->fh->fd, &attrs);
-	if (ret == 0) {
-		sbuf->st_ex_calculated_birthtime = false;
-		sbuf->st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
-		sbuf->st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
-	}
-	return 0;
+	return ret;
 }
 
 static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
 			  struct smb_filename *smb_fname)
 {
-	struct gpfs_winattr attrs;
-	char *path = NULL;
-	NTSTATUS status;
 	int ret;
 	struct gpfs_config_data *config;
 
@@ -1798,35 +1747,13 @@ static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
 				return -1);
 
 	ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
-#if defined(HAVE_FSTATAT)
 	if (ret == -1 && errno == EACCES) {
 		DEBUG(10, ("Trying lstat with capability for %s\n",
 			   smb_fname->base_name));
 		ret = stat_with_capability(handle, smb_fname,
 					   AT_SYMLINK_NOFOLLOW);
 	}
-#endif
-
-	if (ret == -1) {
-		return -1;
-	}
-	if (!config->winattr) {
-		return 0;
-	}
-
-	status = get_full_smb_filename(talloc_tos(), smb_fname, &path);
-	if (!NT_STATUS_IS_OK(status)) {
-		errno = map_errno_from_nt_status(status);
-		return -1;
-	}
-	ret = gpfswrap_get_winattrs_path(discard_const_p(char, path), &attrs);
-	TALLOC_FREE(path);
-	if (ret == 0) {
-		smb_fname->st.st_ex_calculated_birthtime = false;
-		smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
-		smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
-	}
-	return 0;
+	return ret;
 }
 
 static void timespec_to_gpfs_time(struct timespec ts, gpfs_timestruc_t *gt,
@@ -2571,7 +2498,6 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
 	.fchmod_fn = vfs_gpfs_fchmod,
 	.close_fn = vfs_gpfs_close,
 	.stat_fn = vfs_gpfs_stat,
-	.fstat_fn = vfs_gpfs_fstat,
 	.lstat_fn = vfs_gpfs_lstat,
 	.ntimes_fn = vfs_gpfs_ntimes,
 	.aio_force_fn = vfs_gpfs_aio_force,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list