Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ext2: support statx syscall

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) <yi.zhang@huawei.com>
Signed-off-by: yangerkun <yangerkun@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>

authored by

yangerkun and committed by
Jan Kara
93bc420e 4f5edd82

+32
+1
fs/ext2/ext2.h
··· 774 774 extern void ext2_evict_inode(struct inode *); 775 775 extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int); 776 776 extern int ext2_setattr (struct dentry *, struct iattr *); 777 + extern int ext2_getattr (const struct path *, struct kstat *, u32, unsigned int); 777 778 extern void ext2_set_inode_flags(struct inode *inode); 778 779 extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, 779 780 u64 start, u64 len);
+1
fs/ext2/file.c
··· 199 199 #ifdef CONFIG_EXT2_FS_XATTR 200 200 .listxattr = ext2_listxattr, 201 201 #endif 202 + .getattr = ext2_getattr, 202 203 .setattr = ext2_setattr, 203 204 .get_acl = ext2_get_acl, 204 205 .set_acl = ext2_set_acl,
+26
fs/ext2/inode.c
··· 1637 1637 return __ext2_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL); 1638 1638 } 1639 1639 1640 + int ext2_getattr(const struct path *path, struct kstat *stat, 1641 + u32 request_mask, unsigned int query_falgs) 1642 + { 1643 + struct inode *inode = d_inode(path->dentry); 1644 + struct ext2_inode_info *ei = EXT2_I(inode); 1645 + unsigned int flags; 1646 + 1647 + flags = ei->i_flags & EXT2_FL_USER_VISIBLE; 1648 + if (flags & EXT2_APPEND_FL) 1649 + stat->attributes |= STATX_ATTR_APPEND; 1650 + if (flags & EXT2_COMPR_FL) 1651 + stat->attributes |= STATX_ATTR_COMPRESSED; 1652 + if (flags & EXT2_IMMUTABLE_FL) 1653 + stat->attributes |= STATX_ATTR_IMMUTABLE; 1654 + if (flags & EXT2_NODUMP_FL) 1655 + stat->attributes |= STATX_ATTR_NODUMP; 1656 + stat->attributes_mask |= (STATX_ATTR_APPEND | 1657 + STATX_ATTR_COMPRESSED | 1658 + STATX_ATTR_ENCRYPTED | 1659 + STATX_ATTR_IMMUTABLE | 1660 + STATX_ATTR_NODUMP); 1661 + 1662 + generic_fillattr(inode, stat); 1663 + return 0; 1664 + } 1665 + 1640 1666 int ext2_setattr(struct dentry *dentry, struct iattr *iattr) 1641 1667 { 1642 1668 struct inode *inode = d_inode(dentry);
+2
fs/ext2/namei.c
··· 416 416 #ifdef CONFIG_EXT2_FS_XATTR 417 417 .listxattr = ext2_listxattr, 418 418 #endif 419 + .getattr = ext2_getattr, 419 420 .setattr = ext2_setattr, 420 421 .get_acl = ext2_get_acl, 421 422 .set_acl = ext2_set_acl, ··· 427 426 #ifdef CONFIG_EXT2_FS_XATTR 428 427 .listxattr = ext2_listxattr, 429 428 #endif 429 + .getattr = ext2_getattr, 430 430 .setattr = ext2_setattr, 431 431 .get_acl = ext2_get_acl, 432 432 .set_acl = ext2_set_acl,
+2
fs/ext2/symlink.c
··· 23 23 24 24 const struct inode_operations ext2_symlink_inode_operations = { 25 25 .get_link = page_get_link, 26 + .getattr = ext2_getattr, 26 27 .setattr = ext2_setattr, 27 28 #ifdef CONFIG_EXT2_FS_XATTR 28 29 .listxattr = ext2_listxattr, ··· 32 31 33 32 const struct inode_operations ext2_fast_symlink_inode_operations = { 34 33 .get_link = simple_get_link, 34 + .getattr = ext2_getattr, 35 35 .setattr = ext2_setattr, 36 36 #ifdef CONFIG_EXT2_FS_XATTR 37 37 .listxattr = ext2_listxattr,