]> Git Repo - linux.git/commitdiff
ext2: support statx syscall
authoryangerkun <[email protected]>
Mon, 18 Feb 2019 01:07:02 +0000 (09:07 +0800)
committerJan Kara <[email protected]>
Mon, 18 Feb 2019 14:14:43 +0000 (15:14 +0100)
Since statx, every filesystem should fill the attributes/attributes_mask
in routine getattr. But the generic_fillattr has not fill that, so add
ext2_getattr to do this. This can fix generic/424 while testing ext2.

Reviewed-by: zhangyi (F) <[email protected]>
Signed-off-by: yangerkun <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
fs/ext2/ext2.h
fs/ext2/file.c
fs/ext2/inode.c
fs/ext2/namei.c
fs/ext2/symlink.c

index e770cd100a6ab2f3ac6ac66e28641167b024117b..ae0cd9e81e4819e0c233852d5fd7a25f23941271 100644 (file)
@@ -774,6 +774,7 @@ extern int ext2_write_inode (struct inode *, struct writeback_control *);
 extern void ext2_evict_inode(struct inode *);
 extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
 extern int ext2_setattr (struct dentry *, struct iattr *);
+extern int ext2_getattr (const struct path *, struct kstat *, u32, unsigned int);
 extern void ext2_set_inode_flags(struct inode *inode);
 extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
                       u64 start, u64 len);
index 28b2609f25c1c9502a813c49eacf71d7a7c24256..39c4772e96c9d5decd93d71a2c5303fd2af95917 100644 (file)
@@ -199,6 +199,7 @@ const struct inode_operations ext2_file_inode_operations = {
 #ifdef CONFIG_EXT2_FS_XATTR
        .listxattr      = ext2_listxattr,
 #endif
+       .getattr        = ext2_getattr,
        .setattr        = ext2_setattr,
        .get_acl        = ext2_get_acl,
        .set_acl        = ext2_set_acl,
index 17cdefdc62a839e9b51a066fb0fe9ea95a1b62e4..c27c27300d95894c9de2ae0614e36c3df11bad47 100644 (file)
@@ -1637,6 +1637,32 @@ int ext2_write_inode(struct inode *inode, struct writeback_control *wbc)
        return __ext2_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
 }
 
+int ext2_getattr(const struct path *path, struct kstat *stat,
+               u32 request_mask, unsigned int query_falgs)
+{
+       struct inode *inode = d_inode(path->dentry);
+       struct ext2_inode_info *ei = EXT2_I(inode);
+       unsigned int flags;
+
+       flags = ei->i_flags & EXT2_FL_USER_VISIBLE;
+       if (flags & EXT2_APPEND_FL)
+               stat->attributes |= STATX_ATTR_APPEND;
+       if (flags & EXT2_COMPR_FL)
+               stat->attributes |= STATX_ATTR_COMPRESSED;
+       if (flags & EXT2_IMMUTABLE_FL)
+               stat->attributes |= STATX_ATTR_IMMUTABLE;
+       if (flags & EXT2_NODUMP_FL)
+               stat->attributes |= STATX_ATTR_NODUMP;
+       stat->attributes_mask |= (STATX_ATTR_APPEND |
+                       STATX_ATTR_COMPRESSED |
+                       STATX_ATTR_ENCRYPTED |
+                       STATX_ATTR_IMMUTABLE |
+                       STATX_ATTR_NODUMP);
+
+       generic_fillattr(inode, stat);
+       return 0;
+}
+
 int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
 {
        struct inode *inode = d_inode(dentry);
index 0c26dcc5d85014d57c6f73d153af9314c69e9ca9..ccfbbf59e2fc9cfb4986e8f0c312bb1cf7affb01 100644 (file)
@@ -416,6 +416,7 @@ const struct inode_operations ext2_dir_inode_operations = {
 #ifdef CONFIG_EXT2_FS_XATTR
        .listxattr      = ext2_listxattr,
 #endif
+       .getattr        = ext2_getattr,
        .setattr        = ext2_setattr,
        .get_acl        = ext2_get_acl,
        .set_acl        = ext2_set_acl,
@@ -426,6 +427,7 @@ const struct inode_operations ext2_special_inode_operations = {
 #ifdef CONFIG_EXT2_FS_XATTR
        .listxattr      = ext2_listxattr,
 #endif
+       .getattr        = ext2_getattr,
        .setattr        = ext2_setattr,
        .get_acl        = ext2_get_acl,
        .set_acl        = ext2_set_acl,
index d5589ddcc281fc8d872fae64a16c446da150d9c7..00cdb86794861d77b161f3297895c7cc11e0c7c0 100644 (file)
@@ -23,6 +23,7 @@
 
 const struct inode_operations ext2_symlink_inode_operations = {
        .get_link       = page_get_link,
+       .getattr        = ext2_getattr,
        .setattr        = ext2_setattr,
 #ifdef CONFIG_EXT2_FS_XATTR
        .listxattr      = ext2_listxattr,
@@ -31,6 +32,7 @@ const struct inode_operations ext2_symlink_inode_operations = {
  
 const struct inode_operations ext2_fast_symlink_inode_operations = {
        .get_link       = simple_get_link,
+       .getattr        = ext2_getattr,
        .setattr        = ext2_setattr,
 #ifdef CONFIG_EXT2_FS_XATTR
        .listxattr      = ext2_listxattr,
This page took 0.063947 seconds and 4 git commands to generate.