[PATCH] jfs: Add statx support
From: Anmol Sarma
Date: Mon Jun 03 2019 - 11:18:39 EST
From: Anmol Sarma <me@xxxxxxxxxxxxx>
Return inode creation time and stx_attributes flags
Signed-off-by: Anmol Sarma <me@xxxxxxxxxxxxx>
---
fs/jfs/file.c | 24 ++++++++++++++++++++++++
fs/jfs/jfs_inode.h | 2 ++
fs/jfs/namei.c | 1 +
fs/jfs/symlink.c | 2 ++
4 files changed, 29 insertions(+)
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index 36665fd37095..dedd27591836 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -23,6 +23,7 @@
#include <linux/quotaops.h>
#include "jfs_incore.h"
#include "jfs_inode.h"
+#include "jfs_dinode.h"
#include "jfs_dmap.h"
#include "jfs_txnmgr.h"
#include "jfs_xattr.h"
@@ -139,8 +140,31 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
return rc;
}
+int jfs_getattr(const struct path *path, struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
+{
+ struct inode *inode = d_inode(path->dentry);
+ struct jfs_inode_info *j_inode = JFS_IP(inode);
+ uint ji_flags = j_inode->mode2;
+
+ stat->result_mask |= STATX_BTIME;
+ stat->btime.tv_sec = j_inode->otime;
+ stat->btime.tv_nsec = 0;
+
+ if (ji_flags & JFS_APPEND_FL)
+ stat->attributes |= STATX_ATTR_APPEND;
+ if (ji_flags & JFS_IMMUTABLE_FL)
+ stat->attributes |= STATX_ATTR_IMMUTABLE;
+
+ stat->attributes_mask |= STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE;
+
+ generic_fillattr(inode, stat);
+ return 0;
+}
+
const struct inode_operations jfs_file_inode_operations = {
.listxattr = jfs_listxattr,
+ .getattr = jfs_getattr,
.setattr = jfs_setattr,
#ifdef CONFIG_JFS_POSIX_ACL
.get_acl = jfs_get_acl,
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h
index 7b0b3a40788f..e8279a4cb7f7 100644
--- a/fs/jfs/jfs_inode.h
+++ b/fs/jfs/jfs_inode.h
@@ -39,6 +39,8 @@ extern struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
int fh_len, int fh_type);
extern void jfs_set_inode_flags(struct inode *);
extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
+extern int jfs_getattr(const struct path *path, struct kstat *stat,
+ u32 request_mask, unsigned int query_flags);
extern int jfs_setattr(struct dentry *, struct iattr *);
extern const struct address_space_operations jfs_aops;
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index fa719a1553b6..8070c25f7551 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -1533,6 +1533,7 @@ const struct inode_operations jfs_dir_inode_operations = {
.mknod = jfs_mknod,
.rename = jfs_rename,
.listxattr = jfs_listxattr,
+ .getattr = jfs_getattr,
.setattr = jfs_setattr,
#ifdef CONFIG_JFS_POSIX_ACL
.get_acl = jfs_get_acl,
diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c
index 38320607993e..858e9de8ff74 100644
--- a/fs/jfs/symlink.c
+++ b/fs/jfs/symlink.c
@@ -23,12 +23,14 @@
const struct inode_operations jfs_fast_symlink_inode_operations = {
.get_link = simple_get_link,
+ .getattr = jfs_getattr,
.setattr = jfs_setattr,
.listxattr = jfs_listxattr,
};
const struct inode_operations jfs_symlink_inode_operations = {
.get_link = page_get_link,
+ .getattr = jfs_getattr,
.setattr = jfs_setattr,
.listxattr = jfs_listxattr,
};
--
2.17.1