ANDROID: sdcardfs: Get the blocksize from the lower fs
authorDaniel Rosenberg <drosen@google.com>
Fri, 10 Mar 2017 02:12:16 +0000 (18:12 -0800)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 10 Apr 2017 07:42:16 +0000 (13:12 +0530)
This changes sdcardfs to be more in line with the
getattr in wrapfs, which calls the lower fs's getattr
to get the block size

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 34723223
Change-Id: I1c9e16604ba580a8cdefa17f02dcc489d7351aed

fs/sdcardfs/inode.c

index 8d0875ff571027fee111b554dc855cb2d267af89..f713fad909d8d61c229f71b46ad7bc3785e8de6c 100644 (file)
@@ -856,9 +856,7 @@ static int sdcardfs_fillattr(struct vfsmount *mnt, struct inode *inode, struct k
 static int sdcardfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
                 struct kstat *stat)
 {
-       struct dentry *lower_dentry;
-       struct inode *inode;
-       struct inode *lower_inode;
+       struct kstat lower_stat;
        struct path lower_path;
        struct dentry *parent;
        int err;
@@ -873,16 +871,15 @@ static int sdcardfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
        }
        dput(parent);
 
-       inode = d_inode(dentry);
-
        sdcardfs_get_lower_path(dentry, &lower_path);
-       lower_dentry = lower_path.dentry;
-       lower_inode = sdcardfs_lower_inode(inode);
-
-       sdcardfs_copy_and_fix_attrs(inode, lower_inode);
-       fsstack_copy_inode_size(inode, lower_inode);
-
-       err = sdcardfs_fillattr(mnt, inode, stat);
+       err = vfs_getattr(&lower_path, &lower_stat);
+       if (err)
+               goto out;
+       sdcardfs_copy_and_fix_attrs(d_inode(dentry),
+                             d_inode(lower_path.dentry));
+       err = sdcardfs_fillattr(mnt, d_inode(dentry), stat);
+       stat->blocks = lower_stat.blocks;
+out:
        sdcardfs_put_lower_path(dentry, &lower_path);
        return err;
 }