[PATCH 17/18] orangefs: no more explicit setattr

From: Martin Brandenburg
Date: Tue Dec 12 2017 - 13:35:53 EST


Now inodes will be marked dirty and written back at the appopriate time.

Signed-off-by: Martin Brandenburg <martin@xxxxxxxxxxxxxxxxxxxxx>
---
fs/orangefs/acl.c | 11 +++--------
fs/orangefs/inode.c | 17 -----------------
fs/orangefs/namei.c | 17 -----------------
fs/orangefs/orangefs-kernel.h | 2 --
fs/orangefs/symlink.c | 1 -
5 files changed, 3 insertions(+), 45 deletions(-)

diff --git a/fs/orangefs/acl.c b/fs/orangefs/acl.c
index 480ea059a680..90c25ae741b2 100644
--- a/fs/orangefs/acl.c
+++ b/fs/orangefs/acl.c
@@ -121,8 +121,6 @@ int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
{
int error;
struct iattr iattr;
- int rc;
-
if (type == ACL_TYPE_ACCESS && acl) {
/*
* posix_acl_update_mode checks to see if the permissions
@@ -140,14 +138,11 @@ int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
}

if (acl) {
- rc = __orangefs_set_acl(inode, acl, type);
+ return __orangefs_set_acl(inode, acl, type);
} else {
- iattr.ia_valid = ATTR_MODE;
- rc = orangefs_inode_setattr(inode, &iattr);
+ mark_inode_dirty(inode);
+ return 0;
}
-
- return rc;
-
} else {
return -EINVAL;
}
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 231242a4856e..66c40ac7c4ac 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -115,22 +115,6 @@ int orangefs_getattr(const struct path *path, struct kstat *stat,
return ret;
}

-int orangefs_update_time(struct inode *inode, struct timespec *time, int flags)
-{
- struct iattr iattr;
- gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_update_time: %pU\n",
- get_khandle_from_ino(inode));
- generic_update_time(inode, time, flags);
- memset(&iattr, 0, sizeof iattr);
- if (flags & S_ATIME)
- iattr.ia_valid |= ATTR_ATIME;
- if (flags & S_CTIME)
- iattr.ia_valid |= ATTR_CTIME;
- if (flags & S_MTIME)
- iattr.ia_valid |= ATTR_MTIME;
- return orangefs_inode_setattr(inode, &iattr);
-}
-
/* ORANGEDS2 implementation of VFS inode operations for files */
const struct inode_operations orangefs_file_inode_operations = {
.get_acl = orangefs_get_acl,
@@ -138,7 +122,6 @@ const struct inode_operations orangefs_file_inode_operations = {
.setattr = orangefs_setattr,
.getattr = orangefs_getattr,
.listxattr = orangefs_listxattr,
- .update_time = orangefs_update_time,
};

static int orangefs_init_iops(struct inode *inode)
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c
index 37d7d8214e3e..13ef64fd6302 100644
--- a/fs/orangefs/namei.c
+++ b/fs/orangefs/namei.c
@@ -24,7 +24,6 @@ static int orangefs_create(struct inode *dir,
struct orangefs_kernel_op_s *new_op;
struct orangefs_object_kref ref;
struct inode *inode;
- struct iattr iattr;
int ret;

gossip_debug(GOSSIP_NAME_DEBUG, "%s: %pd\n",
@@ -92,9 +91,6 @@ static int orangefs_create(struct inode *dir,
dentry);

dir->i_mtime = dir->i_ctime = current_time(dir);
- memset(&iattr, 0, sizeof iattr);
- iattr.ia_valid |= ATTR_MTIME;
- orangefs_inode_setattr(dir, &iattr);
mark_inode_dirty_sync(dir);
ret = 0;
out:
@@ -231,7 +227,6 @@ static int orangefs_unlink(struct inode *dir, struct dentry *dentry)
struct inode *inode = dentry->d_inode;
struct orangefs_inode_s *parent = ORANGEFS_I(dir);
struct orangefs_kernel_op_s *new_op;
- struct iattr iattr;
int ret;

gossip_debug(GOSSIP_NAME_DEBUG,
@@ -272,9 +267,6 @@ static int orangefs_unlink(struct inode *dir, struct dentry *dentry)
drop_nlink(inode);

dir->i_mtime = dir->i_ctime = current_time(dir);
- memset(&iattr, 0, sizeof iattr);
- iattr.ia_valid |= ATTR_MTIME;
- orangefs_inode_setattr(dir, &iattr);
mark_inode_dirty_sync(dir);
}
return ret;
@@ -288,7 +280,6 @@ static int orangefs_symlink(struct inode *dir,
struct orangefs_kernel_op_s *new_op;
struct orangefs_object_kref ref;
struct inode *inode;
- struct iattr iattr;
int mode = 755;
int ret;

@@ -363,9 +354,6 @@ static int orangefs_symlink(struct inode *dir,
dentry);

dir->i_mtime = dir->i_ctime = current_time(dir);
- memset(&iattr, 0, sizeof iattr);
- iattr.ia_valid |= ATTR_MTIME;
- orangefs_inode_setattr(dir, &iattr);
mark_inode_dirty_sync(dir);
ret = 0;
out:
@@ -378,7 +366,6 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
struct orangefs_kernel_op_s *new_op;
struct orangefs_object_kref ref;
struct inode *inode;
- struct iattr iattr;
int ret;

/* Need directory updates to be on server prior to issuing op. */
@@ -444,9 +431,6 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
* across clients; keep constant at 1.
*/
dir->i_mtime = dir->i_ctime = current_time(dir);
- memset(&iattr, 0, sizeof iattr);
- iattr.ia_valid |= ATTR_MTIME;
- orangefs_inode_setattr(dir, &iattr);
mark_inode_dirty_sync(dir);
out:
return ret;
@@ -530,5 +514,4 @@ const struct inode_operations orangefs_dir_inode_operations = {
.setattr = orangefs_setattr,
.getattr = orangefs_getattr,
.listxattr = orangefs_listxattr,
- .update_time = orangefs_update_time,
};
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index 9c0b575a16e8..4cabde0a5e9f 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -407,8 +407,6 @@ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr);
int orangefs_getattr(const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int flags);

-int orangefs_update_time(struct inode *, struct timespec *, int);
-
/*
* defined in xattr.c
*/
diff --git a/fs/orangefs/symlink.c b/fs/orangefs/symlink.c
index c08f81af1090..4e72f289d3de 100644
--- a/fs/orangefs/symlink.c
+++ b/fs/orangefs/symlink.c
@@ -14,5 +14,4 @@ const struct inode_operations orangefs_symlink_inode_operations = {
.setattr = orangefs_setattr,
.getattr = orangefs_getattr,
.listxattr = orangefs_listxattr,
- .update_time = orangefs_update_time,
};
--
2.15.1