[PATCH v3 6/7] e2fsck: INODE64 high part is more important then LUFID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Keep the INO64 field over LUFID, since it is both smaller,
and more important.

Lustre-bug: https://jira.hpdd.intel.com/browse/LU-9309
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@xxxxxxxxx>
---
 e2fsck/pass2.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 9ed1c193..e5c1504c 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -372,10 +372,14 @@ void ext2_fix_dirent_dirdata(struct ext2_dir_entry *de)
 	__u8 de_flags = (de->name_len >> 8) & ~EXT2_FT_MASK;
 	__u8 name_len = de->name_len & EXT2_NAME_LEN;
 	__u8 new_flag = 0;
+	char *startp = de->name + (de->name_len & EXT2_NAME_LEN) + 1 /* NUL */;
+	char *lenp = startp;
+	char *inop = NULL;
 	int i;
 
 	for (i = 0; i < 4; i++) {
-		__u8 flags = new_flag | (1 << i) << 4;
+		__u8 current_flag = (1 << i) << 4;
+		__u8 flags = new_flag | current_flag;
 
 		/* new_flag is accumulating flags that are set in de_flags
 		 * and still fit inside rec_len. ext2_get_dirent_dirdata_size()
@@ -387,6 +391,11 @@ void ext2_fix_dirent_dirdata(struct ext2_dir_entry *de)
 								      flags);
 			int rlen = __EXT2_DIR_REC_LEN(name_len + dirdatalen);
 
+			if (current_flag == EXT2_DIRENT_INODE)
+				inop = lenp;
+
+			lenp += *lenp;
+
 			if (rlen > de->rec_len)
 				break;
 
@@ -394,6 +403,17 @@ void ext2_fix_dirent_dirdata(struct ext2_dir_entry *de)
 		}
 	}
 
+	/* Keep the INO64 field over  LUFID, since it is both smaller,
+	 * and more important.
+	 */
+	if (inop && (ext2_get_dirdata_field_size(de, new_flag) >= 5) &&
+	    !(new_flag & EXT2_DIRENT_INODE)) {
+		new_flag &= ~EXT2_DIRENT_LUFID;
+		new_flag |= EXT2_DIRENT_INODE;
+		memmove(startp, inop,
+			ext2_get_dirdata_field_size(de, new_flag));
+	}
+
 	de->name_len = name_len | file_type | (new_flag << 8);
 }
 
-- 
2.14.3 (Apple Git-98)





[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux