vfs_gpfs: Store the winattrs in st.vfs_private
authorVolker Lendecke <vl@samba.org>
Wed, 4 May 2011 13:42:54 +0000 (15:42 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 4 May 2011 14:11:30 +0000 (16:11 +0200)
This avoids a considerable amount of gpfs_winattr calls

source3/modules/vfs_gpfs.c

index b8bc1b239bcaaafe3bdc1e3199f50af1de9f10ef..e8d8bd38aeb02d018460ce2f405b064b27a3c106 100644 (file)
@@ -1088,6 +1088,7 @@ static int vfs_gpfs_stat(struct vfs_handle_struct *handle,
        if (ret == 0) {
                smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
                smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
+               smb_fname->st.vfs_private = attrs.winAttrs;
        }
        return 0;
 }
@@ -1135,6 +1136,7 @@ static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
        if (ret == 0) {
                smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
                smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
+               smb_fname->st.vfs_private = attrs.winAttrs;
        }
        return 0;
 }
@@ -1199,18 +1201,23 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
        struct gpfs_winattr attrs;
        char *path = NULL;
        NTSTATUS status;
-       int ret;
 
        status = get_full_smb_filename(talloc_tos(), fname, &path);
        if (!NT_STATUS_IS_OK(status)) {
                errno = map_errno_from_nt_status(status);
                return -1;
        }
-       ret = get_gpfs_winattrs(path, &attrs);
 
-       if (ret == -1) {
-               TALLOC_FREE(path);
-               return false;
+       if (VALID_STAT(*sbuf)) {
+               attrs.winAttrs = sbuf->vfs_private;
+       } else {
+               int ret;
+               ret = get_gpfs_winattrs(path, &attrs);
+
+               if (ret == -1) {
+                       TALLOC_FREE(path);
+                       return false;
+               }
        }
        if ((attrs.winAttrs & GPFS_WINATTR_OFFLINE) != 0) {
                DEBUG(10, ("%s is offline\n", path));