Update to support the V2 Bestbits EA format.

bitmap-optimize
Theodore Ts'o 2002-05-22 00:22:38 -04:00
parent bff61a7aaa
commit 0d63467ddb
4 changed files with 25 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2002-05-22 Theodore Ts'o <tytso@mit.edu>
* pass1.c (check_ext_attr): Update to support the V2 Bestbits EA
format. We automatically determine from the first EA
block we visit whether we are using the V1 or V2 format.
2002-05-21 Theodore Ts'o <tytso@mit.edu>
* pass1.c (process_block): If an inode has too many blocks or

View File

@ -984,6 +984,7 @@ static int check_ext_attr(e2fsck_t ctx, struct problem_context *pctx,
struct ext2_ext_attr_entry *entry;
int count;
region_t region;
int ext_attr_ver;
blk = inode->i_file_acl;
if (blk == 0)
@ -1061,10 +1062,13 @@ static int check_ext_attr(e2fsck_t ctx, struct problem_context *pctx,
goto clear_extattr;
header = (struct ext2_ext_attr_header *) block_buf;
pctx->blk = inode->i_file_acl;
if (header->h_magic != EXT2_EXT_ATTR_MAGIC) {
if (fix_problem(ctx, PR_1_BAD_EA_BLOCK, pctx))
goto clear_extattr;
}
if (header->h_magic != EXT2_EXT_ATTR_MAGIC_v1)
ext_attr_ver = 1;
if (header->h_magic != EXT2_EXT_ATTR_MAGIC)
ext_attr_ver = 2;
else if (fix_problem(ctx, PR_1_BAD_EA_BLOCK, pctx))
goto clear_extattr;
if (header->h_blocks != 1) {
if (fix_problem(ctx, PR_1_EA_MULTI_BLOCK, pctx))
goto clear_extattr;
@ -1089,7 +1093,10 @@ static int check_ext_attr(e2fsck_t ctx, struct problem_context *pctx,
if (fix_problem(ctx, PR_1_EA_ALLOC_COLLISION, pctx))
goto clear_extattr;
}
if (entry->e_name_len == 0 || entry->e_name_index != 0) {
if ((ext_attr_ver == 1 &&
(entry->e_name_len == 0 || entry->e_name_index != 0)) ||
(ext_attr_ver == 2 &&
entry->e_name_index == 0)) {
if (fix_problem(ctx, PR_1_EA_BAD_NAME, pctx))
goto clear_extattr;
}

View File

@ -1,3 +1,7 @@
2002-05-21 Theodore Ts'o <tytso@mit.edu>
* ext2_ext_attr.h: Update to V2 version of the Bestbits format.
2002-05-16 Andreas Dilger <adilger@clusterfs.com>
* ext2_fs.h: Change limits to support filesystems with 8k blocks.

View File

@ -7,7 +7,8 @@
*/
/* Magic value in attribute blocks */
#define EXT2_EXT_ATTR_MAGIC 0xEA010000
#define EXT2_EXT_ATTR_MAGIC_v1 0xEA010000
#define EXT2_EXT_ATTR_MAGIC 0xEA020000
/* Maximum number of references to one attribute block */
#define EXT2_EXT_ATTR_REFCOUNT_MAX 1024
@ -22,7 +23,7 @@ struct ext2_ext_attr_header {
struct ext2_ext_attr_entry {
__u8 e_name_len; /* length of name */
__u8 e_name_index; /* index into table of names (n/i) */
__u8 e_name_index; /* attribute name index */
__u16 e_value_offs; /* offset in disk block of value */
__u32 e_value_block; /* disk block attribute is stored on (n/i) */
__u32 e_value_size; /* size of attribute value */