diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2010-11-10 10:14:57 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2010-11-30 05:30:19 -0500 |
commit | 2ae51ed7b548c1d943d080da617515e801ea5c3e (patch) | |
tree | b2ed48042eef41f89d8316b70bbbb6c936d3dc76 /fs/gfs2 | |
parent | 9e55cd53728719ac3a3234a6618259ab8e203a10 (diff) |
GFS2: Clean up duplicated setattr code
While preparing the last patch I noticed that the gfs2_setattr_simple
code had been duplicated into two other places. This patch updates
those to call gfs2_setattr_simple rather than open coding it.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/ops_inode.c | 9 | ||||
-rw-r--r-- | fs/gfs2/xattr.c | 14 |
2 files changed, 2 insertions, 21 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 457ecd155187..1db6b7343229 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -1069,7 +1069,6 @@ static int setattr_chown(struct inode *inode, struct iattr *attr) | |||
1069 | { | 1069 | { |
1070 | struct gfs2_inode *ip = GFS2_I(inode); | 1070 | struct gfs2_inode *ip = GFS2_I(inode); |
1071 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 1071 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
1072 | struct buffer_head *dibh; | ||
1073 | u32 ouid, ogid, nuid, ngid; | 1072 | u32 ouid, ogid, nuid, ngid; |
1074 | int error; | 1073 | int error; |
1075 | 1074 | ||
@@ -1100,16 +1099,10 @@ static int setattr_chown(struct inode *inode, struct iattr *attr) | |||
1100 | if (error) | 1099 | if (error) |
1101 | goto out_gunlock_q; | 1100 | goto out_gunlock_q; |
1102 | 1101 | ||
1103 | error = gfs2_meta_inode_buffer(ip, &dibh); | 1102 | error = gfs2_setattr_simple(ip, attr); |
1104 | if (error) | 1103 | if (error) |
1105 | goto out_end_trans; | 1104 | goto out_end_trans; |
1106 | 1105 | ||
1107 | setattr_copy(inode, attr); | ||
1108 | mark_inode_dirty(inode); | ||
1109 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | ||
1110 | gfs2_dinode_out(ip, dibh->b_data); | ||
1111 | brelse(dibh); | ||
1112 | |||
1113 | if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) { | 1106 | if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) { |
1114 | u64 blocks = gfs2_get_inode_blocks(&ip->i_inode); | 1107 | u64 blocks = gfs2_get_inode_blocks(&ip->i_inode); |
1115 | gfs2_quota_change(ip, -blocks, ouid, ogid); | 1108 | gfs2_quota_change(ip, -blocks, ouid, ogid); |
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index ecfd40dd28ad..439b61c03262 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c | |||
@@ -1296,10 +1296,8 @@ fail: | |||
1296 | 1296 | ||
1297 | int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | 1297 | int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) |
1298 | { | 1298 | { |
1299 | struct inode *inode = &ip->i_inode; | ||
1300 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1299 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1301 | struct gfs2_ea_location el; | 1300 | struct gfs2_ea_location el; |
1302 | struct buffer_head *dibh; | ||
1303 | int error; | 1301 | int error; |
1304 | 1302 | ||
1305 | error = gfs2_ea_find(ip, GFS2_EATYPE_SYS, GFS2_POSIX_ACL_ACCESS, &el); | 1303 | error = gfs2_ea_find(ip, GFS2_EATYPE_SYS, GFS2_POSIX_ACL_ACCESS, &el); |
@@ -1321,17 +1319,7 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | |||
1321 | if (error) | 1319 | if (error) |
1322 | return error; | 1320 | return error; |
1323 | 1321 | ||
1324 | error = gfs2_meta_inode_buffer(ip, &dibh); | 1322 | error = gfs2_setattr_simple(ip, attr); |
1325 | if (error) | ||
1326 | goto out_trans_end; | ||
1327 | |||
1328 | setattr_copy(inode, attr); | ||
1329 | mark_inode_dirty(inode); | ||
1330 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | ||
1331 | gfs2_dinode_out(ip, dibh->b_data); | ||
1332 | brelse(dibh); | ||
1333 | |||
1334 | out_trans_end: | ||
1335 | gfs2_trans_end(sdp); | 1323 | gfs2_trans_end(sdp); |
1336 | return error; | 1324 | return error; |
1337 | } | 1325 | } |