Skip to contentSkip to conversation

xfs: Remove dead code from inode recover function

PATCH In review Nikolay Borisov 2 participants 2 messages Feb 21, 2018 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: Remove dead code from inode recover function

The memcpy is guarded by a check which is performed a right before we call xfs_log_dinode_to_disk. At this point we are sure this check will always be false otherwise we would have errored out. So let's remove this dead weight.

---
 fs/xfs/xfs_log_recover.c | 7 -------
 1 file changed, 7 deletions(-)
fs/xfs/xfs_log_recover.c +0 -7
index 00240c9ee72e..cb20f2e83412 100644
@@ -3173,13 +3173,6 @@ xlog_recover_inode_pass2(
 	/* recover the log dinode inode into the on disk inode */
 	xfs_log_dinode_to_disk(ldip, dip);
 
-	/* the rest is in on-disk format */
-	if (item->ri_buf[1].i_len > isize) {
-		memcpy((char *)dip + isize,
-			item->ri_buf[1].i_addr + isize,
-			item->ri_buf[1].i_len - isize);
-	}
-
 	fields = in_f->ilf_fields;
 	if (fields & XFS_ILOG_DEV)
 		xfs_dinode_put_rdev(dip, in_f->ilf_u.ilfu_rdev);
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Nikolay Borisov

The memcpy is guarded by a check which is performed a right before we call xfs_log_dinode_to_disk. At this point we are sure this check will always be false otherwise we would have errored out. So let's remove this dead weight.

---

Looks good, memcpy will never be executed here, -EFSCORRUPTED will be returned if this condition is true right before this memcpy call.

Quoted 28 lines
 fs/xfs/xfs_log_recover.c | 7 -------
 1 file changed, 7 deletions(-)
fs/xfs/xfs_log_recover.c +0 -7
index 00240c9ee72e..cb20f2e83412 100644
@@ -3173,13 +3173,6 @@ xlog_recover_inode_pass2(
 	/* recover the log dinode inode into the on disk inode */
 	xfs_log_dinode_to_disk(ldip, dip);
 
-	/* the rest is in on-disk format */
-	if (item->ri_buf[1].i_len > isize) {
-		memcpy((char *)dip + isize,
-			item->ri_buf[1].i_addr + isize,
-			item->ri_buf[1].i_len - isize);
-	}
-
 	fields = in_f->ilf_fields;
 	if (fields & XFS_ILOG_DEV)
 		xfs_dinode_put_rdev(dip, in_f->ilf_u.ilfu_rdev);
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Carlos