From 3080a74ea39eece6ac21aae768c48ab8b1f89ac1 Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Sun, 23 Oct 2011 19:28:32 +0900 Subject: udf: Skip mirror metadata FE loading when metadata FE is ok It is not necessary to load mirror metadata FE when metadata FE is OK. So try to read it only the first time udf_get_pblock_meta25() fails to map the block from metadata FE. Signed-off-by: Ashish Sangwan Signed-off-by: Namjae Jeon Signed-off-by: Jan Kara --- fs/udf/udf_sb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/udf/udf_sb.h') diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index 4858c191242b..a3146b05feeb 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h @@ -61,6 +61,7 @@ struct udf_meta_data { __u32 s_alloc_unit_size; __u16 s_align_unit_size; __u8 s_dup_md_flag; + __u8 s_mirror_loaded_flag; struct inode *s_metadata_fe; struct inode *s_mirror_fe; struct inode *s_bitmap_fe; -- cgit v1.2.3 From ed47a7d00c22b326fc4c97342a73ecd15929732e Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Mon, 24 Oct 2011 16:47:48 +0200 Subject: udf: Cleanup metadata flags handling Use simple ->s_flags variable instead of u8 variable for each flag. Signed-off-by: Jan Kara --- fs/udf/partition.c | 4 ++-- fs/udf/super.c | 8 ++++---- fs/udf/udf_sb.h | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'fs/udf/udf_sb.h') diff --git a/fs/udf/partition.c b/fs/udf/partition.c index b526f25c04c9..d6caf01a2097 100644 --- a/fs/udf/partition.c +++ b/fs/udf/partition.c @@ -323,10 +323,10 @@ uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block, retblk = udf_try_read_meta(inode, block, partition, offset); if (retblk == 0xFFFFFFFF && mdata->s_metadata_fe) { udf_warn(sb, "error reading from METADATA, trying to read from MIRROR\n"); - if (!mdata->s_mirror_loaded_flag) { + if (!(mdata->s_flags & MF_MIRROR_FE_LOADED)) { mdata->s_mirror_fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc, map->s_partition_num); - mdata->s_mirror_loaded_flag = 1; + mdata->s_flags |= MF_MIRROR_FE_LOADED; } inode = mdata->s_mirror_fe; diff --git a/fs/udf/super.c b/fs/udf/super.c index dfe043a36593..e185253470df 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1333,8 +1333,8 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, le32_to_cpu(mdm->allocUnitSize); mdata->s_align_unit_size = le16_to_cpu(mdm->alignUnitSize); - mdata->s_dup_md_flag = - mdm->flags & 0x01; + if (mdm->flags & 0x01) + mdata->s_flags |= MF_DUPLICATE_MD; udf_debug("Metadata Ident suffix=0x%x\n", le16_to_cpu(*(__le16 *) @@ -1349,8 +1349,8 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, le32_to_cpu(mdm->metadataMirrorFileLoc)); udf_debug("Bitmap file loc=%d\n", le32_to_cpu(mdm->metadataBitmapFileLoc)); - udf_debug("Duplicate Flag: %d %d\n", - mdata->s_dup_md_flag, mdm->flags); + udf_debug("Flags: %d %d\n", + mdata->s_flags, mdm->flags); } else { udf_debug("Unknown ident: %s\n", upm2->partIdent.ident); diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index a3146b05feeb..5142a82e3276 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h @@ -54,14 +54,16 @@ #pragma pack(1) /* XXX(hch): Why? This file just defines in-core structures */ +#define MF_DUPLICATE_MD 0x01 +#define MF_MIRROR_FE_LOADED 0x02 + struct udf_meta_data { __u32 s_meta_file_loc; __u32 s_mirror_file_loc; __u32 s_bitmap_file_loc; __u32 s_alloc_unit_size; __u16 s_align_unit_size; - __u8 s_dup_md_flag; - __u8 s_mirror_loaded_flag; + int s_flags; struct inode *s_metadata_fe; struct inode *s_mirror_fe; struct inode *s_bitmap_fe; -- cgit v1.2.3