OSDN Git Service

Remove check in e2fsck which requires EA's in inodes to be sorted
authorKalpak Shah <kalpak@clusterfs.com>
Tue, 8 May 2007 05:07:30 +0000 (01:07 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 8 May 2007 05:07:30 +0000 (01:07 -0400)
This patch removes a code snippet from check_ea_in_inode() in pass1 which checks
if the EA values in the inode are sorted or not. The comments in fs/ext*/xattr.c
state that the EA values in the external EA block are sorted but those in the
inode need not be sorted. I have also attached a test image which has unsorted
EAs in the inodes. The current e2fsck wrongly clears the EAs in the inode.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
e2fsck/ChangeLog
e2fsck/pass1.c

index 4c14041..e5809d3 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-08  Kalpak Shah <kalpak@clusterfs.com>
+
+       * pass1.c (check_ea_in_inode): Remove check that requires in-inode
+               EA's to be sorted, since they don't have to be.
+
 2007-05-08  Theodore Tso  <tytso@mit.edu>
 
        * message.c (expand_inode_expression): Use inode_uid() and
index 19b8864..830974f 100644 (file)
@@ -246,7 +246,7 @@ static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx)
        struct ext2_inode_large *inode;
        struct ext2_ext_attr_entry *entry;
        char *start, *end;
-       unsigned int storage_size, remain, offs;
+       unsigned int storage_size, remain;
        int problem = 0;
 
        inode = (struct ext2_inode_large *) pctx->inode;
@@ -261,7 +261,6 @@ static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx)
 
        /* take finish entry 0UL into account */
        remain = storage_size - sizeof(__u32); 
-       offs = end - start;
 
        while (!EXT2_EXT_IS_LAST_ENTRY(entry)) {
 
@@ -285,15 +284,6 @@ static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx)
                        goto fix;
                }
 
-               /* check value placement */
-               if (entry->e_value_offs + 
-                   EXT2_XATTR_SIZE(entry->e_value_size) != offs) {
-                       printf("(entry->e_value_offs + entry->e_value_size: %d, offs: %d)\n", entry->e_value_offs + entry->e_value_size, offs);
-                       pctx->num = entry->e_value_offs;
-                       problem = PR_1_ATTR_VALUE_OFFSET;
-                       goto fix;
-               }
-       
                /* e_value_block must be 0 in inode's ea */
                if (entry->e_value_block != 0) {
                        pctx->num = entry->e_value_block;
@@ -309,7 +299,6 @@ static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx)
                }
 
                remain -= entry->e_value_size;
-               offs -= EXT2_XATTR_SIZE(entry->e_value_size);
 
                entry = EXT2_EXT_ATTR_NEXT(entry);
        }