From: Namjae Jeon <linkinjeon@gmail.com>
To: jack@suse.cz
Cc: linux-kernel@vger.kernel.org, Namjae Jeon <linkinjeon@gmail.com>,
Ashish Sangwan <ashishsangwan2@gmail.com>
Subject: [PATCH] udf : skip mirror metadata FE since metadata FE is ok.
Date: Thu, 20 Oct 2011 00:03:18 +0900 [thread overview]
Message-ID: <1319036598-4367-1-git-send-email-linkinjeon@gmail.com> (raw)
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@gmail.com>
Signed-off-by: Ashish Sangwan <ashishsangwan2@gmail.com>
---
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) {
+ /* 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;
+ }
+ }
+
inode = mdata->s_mirror_fe;
if (!inode)
return 0xFFFFFFFF;
diff --git a/fs/udf/super.c b/fs/udf/super.c
index e58123a..659d088 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -857,29 +857,28 @@ static int udf_load_metadata_files(struct super_block *sb, int partition)
mdata->s_metadata_fe = NULL;
}
- /* mirror file entry */
- addr.logicalBlockNum = mdata->s_mirror_file_loc;
- addr.partitionReferenceNum = map->s_partition_num;
+ if (fe_error) {
+ /* 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);
+ udf_debug("Mirror metadata file location: block = %d part = %d\n",
+ addr.logicalBlockNum, addr.partitionReferenceNum);
- mdata->s_mirror_fe = udf_iget(sb, &addr);
+ mdata->s_mirror_fe = udf_iget(sb, &addr);
- if (mdata->s_mirror_fe == NULL) {
- if (fe_error) {
+ if (mdata->s_mirror_fe == NULL) {
udf_err(sb, "mirror inode efe not found and metadata inode is missing too, exiting...\n");
goto error_exit;
- } else
- udf_warn(sb, "mirror inode efe not found, but metadata inode is OK\n");
- } 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;
- if (fe_error)
+ } 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;
goto error_exit;
- }
+ }
+ } else
+ mdata->s_mirror_fe = NULL;
/*
* bitmap file entry
--
1.7.4.4
next reply other threads:[~2011-10-19 15:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-19 15:03 Namjae Jeon [this message]
2011-10-20 23:47 ` [PATCH] udf : skip mirror metadata FE since metadata FE is ok Jan Kara
2011-10-23 1:24 ` NamJae Jeon
2011-10-23 1:24 ` NamJae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319036598-4367-1-git-send-email-linkinjeon@gmail.com \
--to=linkinjeon@gmail.com \
--cc=ashishsangwan2@gmail.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).