<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre wrap="">Signed-off-by: Srinivas Eeda <a
class="moz-txt-link-rfc2396E" href="mailto:srinivas.eeda@oracle.com"><srinivas.eeda@oracle.com></a>
On 5/21/2010 11:14 AM, Mark Fasheh wrote:</pre>
<blockquote cite="mid:20100521181410.GD23652@wotan.suse.de" type="cite">
<pre wrap="">On Thu, May 20, 2010 at 11:49:41AM +0800, Wengang Wang wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On 10-05-20 11:51, Coly Li wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
On 05/20/2010 10:20 AM, Mark Fasheh Wrote:
</pre>
<blockquote type="cite">
<pre wrap="">O2image wasn't picking up the entire dx_tree. This adds detection of an
indexed dir to o2image so that it can traverse the tree in dx_root->dr_list
and record the meta data within.
Signed-off-by: Mark Fasheh <a class="moz-txt-link-rfc2396E" href="mailto:mfasheh@suse.com"><mfasheh@suse.com></a>
---
o2image/o2image.c | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/o2image/o2image.c b/o2image/o2image.c
</pre>
</blockquote>
<pre wrap="">[snip]
</pre>
<blockquote type="cite">
<pre wrap=""> static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode)
{
        struct ocfs2_super_block *super;
@@ -234,9 +260,14 @@ static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode)
                ret = traverse_chains(ofs, &(di->id2.i_chain), dump_type);
        else if (di->i_flags & OCFS2_DEALLOC_FL)
                ret = mark_dealloc_bits(ofs, &(di->id2.i_dealloc));
-        else
+        else {
+                if (S_ISDIR(di->i_mode) &&
+                 (di->i_dyn_features & OCFS2_INDEXED_DIR_FL)) {
+                        ret = traverse_dx_root(ofs, di->i_dx_root);
+                }
</pre>
</blockquote>
<pre wrap="">Hi Mark,
How about call ocfs2_supports_indexed_dirs() before check di->i_dyn_features, like this,
+        else {
+                if (S_ISDIR(di->i_mode) &&
+                 ocfs2_supports_indexed_dirs(super) &&
+                 (di->i_dyn_features & OCFS2_INDEXED_DIR_FL)) {
+                        ret = traverse_dx_root(ofs, di->i_dx_root);
+                }
</pre>
</blockquote>
<pre wrap="">Hi Coly,
If this can happen(I'm not sure), seems we shouldn't add the super
check.
indexed dir feature enabled when mkfs or tunefs;
then some indexed dirs created on disk;
indexed dir feature disabled by tunefs;
o2image;
</pre>
</blockquote>
<pre wrap=""><!---->
Technically that should never happen, but it's those types of bugs which I
was thinking of when I ommitted the ocfs2_supports_indexed_dirs() check.
Here's a new version, with a comment. I actually added a check using
ocfs2_supports_indexed_dirs() but that's for reporting errors (or ignoring
them if the feature isn't set).
        --Mark
--
Mark Fasheh
From: Mark Fasheh <a class="moz-txt-link-rfc2396E" href="mailto:mfasheh@suse.com"><mfasheh@suse.com></a>
o2image: dx_dirs support
o2image wasn't picking up the entire dx_tree. This adds detection of an
indexed dir to o2image so that it can traverse the tree in dx_root->dr_list
and record the meta data within.
Signed-off-by: Mark Fasheh <a class="moz-txt-link-rfc2396E" href="mailto:mfasheh@suse.com"><mfasheh@suse.com></a>
---
o2image/o2image.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 47 insertions(+), 1 deletions(-)
diff --git a/o2image/o2image.c b/o2image/o2image.c
index 6f32486..358639b 100644
--- a/o2image/o2image.c
+++ b/o2image/o2image.c
@@ -169,6 +169,32 @@ out:
        return ret;
}
+static errcode_t traverse_dx_root(ocfs2_filesys *ofs, uint64_t blkno)
+{
+        errcode_t ret;
+        char *buf = NULL;
+        struct ocfs2_dx_root_block *dx_root;
+
+        ocfs2_image_mark_bitmap(ofs, blkno);
+
+        ret = ocfs2_malloc_block(ofs->fs_io, &buf);
+        if (ret)
+                goto out;
+
+        ret = ocfs2_read_dx_root(ofs, blkno, buf);
+        if (ret)
+                goto out;
+
+        dx_root = (struct ocfs2_dx_root_block *) buf;
+        if (!(dx_root->dr_flags & OCFS2_DX_FLAG_INLINE))
+                traverse_extents(ofs, &dx_root->dr_list);
+
+out:
+        if (buf)
+                ocfs2_free(&buf);
+        return ret;
+}
+
static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode)
{
        struct ocfs2_super_block *super;
@@ -234,10 +260,30 @@ static errcode_t traverse_inode(ocfs2_filesys *ofs, uint64_t inode)
                ret = traverse_chains(ofs, &(di->id2.i_chain), dump_type);
        else if (di->i_flags & OCFS2_DEALLOC_FL)
                ret = mark_dealloc_bits(ofs, &(di->id2.i_dealloc));
-        else
+        else {
+                /*
+                 * Don't check superblock flag for the dir indexing
+                 * feature in case it (or the directory) is corrupted
+                 * we want to try to pick up as much of the supposed
+                 * index as possible.
+                 *
+                 * Error reporting is a bit different though. If the
+                 * directory indexing feature is set on the super
+                 * block, we should fail here to indicate an
+                 * incomplete inode. Otherwise it is safe to ignore
+                 * errors from traverse_dx_root.
+                 */
+                if (S_ISDIR(di->i_mode) &&
+                 (di->i_dyn_features & OCFS2_INDEXED_DIR_FL)) {
+                        ret = traverse_dx_root(ofs, di->i_dx_root);
+                        if (ret && ocfs2_supports_indexed_dirs(super))
+                         goto out_error;
+                }
                /* traverse extents for system files */
                ret = traverse_extents(ofs, &(di->id2.i_list));
+        }
+out_error:
        if (ret) {
                com_err(program_name, ret, "while scanning inode %"PRIu64"",
                        inode);
</pre>
</blockquote>
</body>
</html>