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

gfs2: Move GIF_ALLOC_FAILED check out of gfs2_ea_dealloc

Don't check for the GIF_ALLOC_FAILED flag in gfs2_ea_dealloc() and pass
that information explicitly instead. This allows for a cleaner
follow-up patch.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>

+8 -7
+1 -1
fs/gfs2/super.c
··· 1314 1314 } 1315 1315 1316 1316 if (ip->i_eattr) { 1317 - ret = gfs2_ea_dealloc(ip); 1317 + ret = gfs2_ea_dealloc(ip, !test_bit(GIF_ALLOC_FAILED, &ip->i_flags)); 1318 1318 if (ret) 1319 1319 goto out; 1320 1320 }
+6 -5
fs/gfs2/xattr.c
··· 1383 1383 return error; 1384 1384 } 1385 1385 1386 - static int ea_dealloc_block(struct gfs2_inode *ip) 1386 + static int ea_dealloc_block(struct gfs2_inode *ip, bool initialized) 1387 1387 { 1388 1388 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 1389 1389 struct gfs2_rgrpd *rgd; ··· 1416 1416 ip->i_eattr = 0; 1417 1417 gfs2_add_inode_blocks(&ip->i_inode, -1); 1418 1418 1419 - if (likely(!test_bit(GIF_ALLOC_FAILED, &ip->i_flags))) { 1419 + if (initialized) { 1420 1420 error = gfs2_meta_inode_buffer(ip, &dibh); 1421 1421 if (!error) { 1422 1422 gfs2_trans_add_meta(ip->i_gl, dibh); ··· 1435 1435 /** 1436 1436 * gfs2_ea_dealloc - deallocate the extended attribute fork 1437 1437 * @ip: the inode 1438 + * @initialized: xattrs have been initialized 1438 1439 * 1439 1440 * Returns: errno 1440 1441 */ 1441 1442 1442 - int gfs2_ea_dealloc(struct gfs2_inode *ip) 1443 + int gfs2_ea_dealloc(struct gfs2_inode *ip, bool initialized) 1443 1444 { 1444 1445 int error; 1445 1446 ··· 1452 1451 if (error) 1453 1452 return error; 1454 1453 1455 - if (likely(!test_bit(GIF_ALLOC_FAILED, &ip->i_flags))) { 1454 + if (initialized) { 1456 1455 error = ea_foreach(ip, ea_dealloc_unstuffed, NULL); 1457 1456 if (error) 1458 1457 goto out_quota; ··· 1464 1463 } 1465 1464 } 1466 1465 1467 - error = ea_dealloc_block(ip); 1466 + error = ea_dealloc_block(ip, initialized); 1468 1467 1469 1468 out_quota: 1470 1469 gfs2_quota_unhold(ip);
+1 -1
fs/gfs2/xattr.h
··· 54 54 const void *value, size_t size, 55 55 int flags, int type); 56 56 ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size); 57 - int gfs2_ea_dealloc(struct gfs2_inode *ip); 57 + int gfs2_ea_dealloc(struct gfs2_inode *ip, bool initialized); 58 58 59 59 /* Exported to acl.c */ 60 60