Commit 2ae51ed7b548c1d943d080da617515e801ea5c3e

Authored by Steven Whitehouse
1 parent 9e55cd5372

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>

Showing 2 changed files with 2 additions and 21 deletions Side-by-side Diff

... ... @@ -1069,7 +1069,6 @@
1069 1069 {
1070 1070 struct gfs2_inode *ip = GFS2_I(inode);
1071 1071 struct gfs2_sbd *sdp = GFS2_SB(inode);
1072   - struct buffer_head *dibh;
1073 1072 u32 ouid, ogid, nuid, ngid;
1074 1073 int error;
1075 1074  
1076 1075  
... ... @@ -1100,15 +1099,9 @@
1100 1099 if (error)
1101 1100 goto out_gunlock_q;
1102 1101  
1103   - error = gfs2_meta_inode_buffer(ip, &dibh);
  1102 + error = gfs2_setattr_simple(ip, attr);
1104 1103 if (error)
1105 1104 goto out_end_trans;
1106   -
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 1105  
1113 1106 if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) {
1114 1107 u64 blocks = gfs2_get_inode_blocks(&ip->i_inode);
... ... @@ -1296,10 +1296,8 @@
1296 1296  
1297 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 1299 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1301 1300 struct gfs2_ea_location el;
1302   - struct buffer_head *dibh;
1303 1301 int error;
1304 1302  
1305 1303 error = gfs2_ea_find(ip, GFS2_EATYPE_SYS, GFS2_POSIX_ACL_ACCESS, &el);
... ... @@ -1321,17 +1319,7 @@
1321 1319 if (error)
1322 1320 return error;
1323 1321  
1324   - error = gfs2_meta_inode_buffer(ip, &dibh);
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:
  1322 + error = gfs2_setattr_simple(ip, attr);
1335 1323 gfs2_trans_end(sdp);
1336 1324 return error;
1337 1325 }