Skip to content

Commit 647e72f

Browse files
author
Andreas Gruenbacher
committed
gfs2: Move GIF_ALLOC_FAILED check out of gfs2_ea_dealloc
JIRA: https://issues.redhat.com/browse/RHEL-88093 Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git 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> (cherry picked from commit feafe3ad774cbf1ed1b86db91771de1538a5f24b)
1 parent c894275 commit 647e72f

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

fs/gfs2/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ static int evict_unlinked_inode(struct inode *inode)
13301330
}
13311331

13321332
if (ip->i_eattr) {
1333-
ret = gfs2_ea_dealloc(ip);
1333+
ret = gfs2_ea_dealloc(ip, !test_bit(GIF_ALLOC_FAILED, &ip->i_flags));
13341334
if (ret)
13351335
goto out;
13361336
}

fs/gfs2/xattr.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
13791379
return error;
13801380
}
13811381

1382-
static int ea_dealloc_block(struct gfs2_inode *ip)
1382+
static int ea_dealloc_block(struct gfs2_inode *ip, bool initialized)
13831383
{
13841384
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
13851385
struct gfs2_rgrpd *rgd;
@@ -1412,7 +1412,7 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
14121412
ip->i_eattr = 0;
14131413
gfs2_add_inode_blocks(&ip->i_inode, -1);
14141414

1415-
if (likely(!test_bit(GIF_ALLOC_FAILED, &ip->i_flags))) {
1415+
if (initialized) {
14161416
error = gfs2_meta_inode_buffer(ip, &dibh);
14171417
if (!error) {
14181418
gfs2_trans_add_meta(ip->i_gl, dibh);
@@ -1431,11 +1431,12 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
14311431
/**
14321432
* gfs2_ea_dealloc - deallocate the extended attribute fork
14331433
* @ip: the inode
1434+
* @initialized: xattrs have been initialized
14341435
*
14351436
* Returns: errno
14361437
*/
14371438

1438-
int gfs2_ea_dealloc(struct gfs2_inode *ip)
1439+
int gfs2_ea_dealloc(struct gfs2_inode *ip, bool initialized)
14391440
{
14401441
int error;
14411442

@@ -1447,7 +1448,7 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip)
14471448
if (error)
14481449
return error;
14491450

1450-
if (likely(!test_bit(GIF_ALLOC_FAILED, &ip->i_flags))) {
1451+
if (initialized) {
14511452
error = ea_foreach(ip, ea_dealloc_unstuffed, NULL);
14521453
if (error)
14531454
goto out_quota;
@@ -1459,7 +1460,7 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip)
14591460
}
14601461
}
14611462

1462-
error = ea_dealloc_block(ip);
1463+
error = ea_dealloc_block(ip, initialized);
14631464

14641465
out_quota:
14651466
gfs2_quota_unhold(ip);

fs/gfs2/xattr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,
5454
const void *value, size_t size,
5555
int flags, int type);
5656
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);
5858

5959
/* Exported to acl.c */
6060

0 commit comments

Comments
 (0)