Re: [PATCH] udf : skip mirror metadata FE since metadata FE is ok.

From: NamJae Jeon
Date: Sat Oct 22 2011 - 21:24:40 EST


2011/10/21 Jan Kara <jack@xxxxxxx>:
> On Thu 20-10-11 00:03:18, Namjae Jeon wrote:
>> By Jan Kara's suggestion, This patch skip mirror metadata FE since
>> metadata FE is ok. And try to read it only the first time
>> udf_get_pblock_meta25() fails to map the block from metadata FE.
>>
>> Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxx>
>> Signed-off-by: Ashish Sangwan <ashishsangwan2@xxxxxxxxx>
>> ---
>> Âfs/udf/partition.c | Â 20 ++++++++++++++++++++
>> Âfs/udf/super.c   |  33 ++++++++++++++++-----------------
>> Â2 files changed, 36 insertions(+), 17 deletions(-)
>>
>> diff --git a/fs/udf/partition.c b/fs/udf/partition.c
>> index f3e472c..8bfc25b 100644
>> --- a/fs/udf/partition.c
>> +++ b/fs/udf/partition.c
>> @@ -311,6 +311,7 @@ uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block,
>> Â Â Â struct udf_meta_data *mdata;
>> Â Â Â uint32_t retblk;
>> Â Â Â struct inode *inode;
>> + Â Â struct kernel_lb_addr addr;
>>
>> Â Â Â udf_debug("READING from METADATA\n");
>>
>> @@ -323,6 +324,25 @@ 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) {
>> Â Â Â Â Â Â Â udf_warn(sb, "error reading from METADATA, trying to read from MIRROR\n");
>> + Â Â Â Â Â Â if (mdata->s_mirror_fe == NULL) {
> ÂThis won't be good because if s_mirror_fe cannot be loaded as well, you'd
> just try loading it on every block mapping which failed from the primary
> metadata map. So you should have a flag somewhere whether in mdata, whether
> you tried loading mirror_fe or not and use that.
>
>> + Â Â Â Â Â Â Â Â Â Â /* mirror file entry */
>> + Â Â Â Â Â Â Â Â Â Â addr.logicalBlockNum = mdata->s_mirror_file_loc;
>> + Â Â Â Â Â Â Â Â Â Â addr.partitionReferenceNum = map->s_partition_num;
>> + Â Â Â Â Â Â Â Â Â Â udf_debug("Mirror metadata file location: block = %d part = %d\n",
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â addr.logicalBlockNum,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â addr.partitionReferenceNum);
>> + Â Â Â Â Â Â Â Â Â Â mdata->s_mirror_fe = udf_iget(sb, &addr);
>> +
>> + Â Â Â Â Â Â Â Â Â Â if (mdata->s_mirror_fe == NULL)
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â udf_err(sb, "mirror inode efe not found");
>> + Â Â Â Â Â Â Â Â Â Â else if (UDF_I(mdata->s_mirror_fe)->i_alloc_type !=
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ICBTAG_FLAG_AD_SHORT) {
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â udf_warn(sb, "mirror inode efe does not have short allocation descriptors!\n");
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â iput(mdata->s_mirror_fe);
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â mdata->s_mirror_fe = NULL;
>> + Â Â Â Â Â Â Â Â Â Â }
> ÂAlso please create a helper function for loading metadata/mirror metadat
> FE so that we don't have loading duplicated in three places... Thanks.
Hi Jan.
Thanks for your review.
I will do it.

>
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂHonza
> --
> Jan Kara <jack@xxxxxxx>
> SUSE Labs, CR
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/