Skip to contentSkip to conversation

ocfs2: improve code readability

PATCH New Sudip Mukherjee 2 participants 2 messages Oct 31, 2014 – Nov 3, 2014 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ocfs2: improve code readability

code was getting confusing as the priority of both the operators ! and & are same.
this change is done to just to improve the readability of the code.

---

hi,
i hope this is the way Weiwei Wang has thought of the logic when giving that BUG_ON, please discard this patch if this assumption was worng.

 fs/ocfs2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +1 -1
index 62620ab..1a05574 100644
@@ -2764,7 +2764,7 @@ int ocfs2_del_inode_from_orphan(struct ocfs2_super *osb,
 		goto bail_unlock_orphan;
 	}
 
-	BUG_ON(!di->i_flags & cpu_to_le32(OCFS2_DIO_ORPHANED_FL));
+	BUG_ON(!(di->i_flags & cpu_to_le32(OCFS2_DIO_ORPHANED_FL)));
 
 	/* Only delete entry if OCFS2_ORPHANED_FL not set, or
 	 * there are two entries added */
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/1 ocfs2: improve code readability

You are right. Actually Andrew has already fixed this in mm tree. Thanks.

Quoted 30 lines · Sudip Mukherjee

code was getting confusing as the priority of both the operators ! and & are same.
this change is done to just to improve the readability of the code.

---

hi,
i hope this is the way Weiwei Wang has thought of the logic when giving that BUG_ON, please discard this patch if this assumption was worng.

 fs/ocfs2/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/namei.c +1 -1
index 62620ab..1a05574 100644
@@ -2764,7 +2764,7 @@ int ocfs2_del_inode_from_orphan(struct ocfs2_super *osb,
 		goto bail_unlock_orphan;
 	}
 
-	BUG_ON(!di->i_flags & cpu_to_le32(OCFS2_DIO_ORPHANED_FL));
+	BUG_ON(!(di->i_flags & cpu_to_le32(OCFS2_DIO_ORPHANED_FL)));
 
 	/* Only delete entry if OCFS2_ORPHANED_FL not set, or
 	 * there are two entries added */