From: Ben Myers <bpm@sgi.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH 3/3] xfs_repair: handle fragmented multiblock dir2 in process_leaf_node_dir2()
Date: Fri, 1 Jun 2012 15:25:42 -0500 [thread overview]
Message-ID: <20120601202542.GL4721@sgi.com> (raw)
In-Reply-To: <4FBABDA1.1030205@redhat.com>
On Mon, May 21, 2012 at 05:11:45PM -0500, Eric Sandeen wrote:
> process_leaf_node_dir2() had the following loop:
>
> while ((dbno = blkmap_next_off(blkmap, ndbno, &t)) < mp->m_dirleafblk) {
> ...
> ndbno = dbno + mp->m_dirblkfsbs - 1;
> ...
> }
>
> which does not account for fragmented multiblock dir2.
>
> ndbno was blindly being advanced by m_dirblkfsbs, but then
> blkmap_next_off() would return the logical block of the next
> mapped extent in blkmap, which may be within the current
> (fragmented) dir2 multi-block, not the next multi-block,
> because the extent index t hadn't been advanced.
>
> Fix this by calling blkmap_next_off() until ndbno has advanced
> into the next multiblock dir2 block, thereby keeping
> the extent index t straight while properly advancing
> ndbno.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> diff --git a/repair/dir2.c b/repair/dir2.c
> index f9562d7..7a614a8 100644
> --- a/repair/dir2.c
> +++ b/repair/dir2.c
> @@ -2003,7 +2003,11 @@ process_leaf_node_dir2(
> ndbno = NULLDFILOFF;
> while ((dbno = blkmap_next_off(blkmap, ndbno, &t)) < mp->m_dirleafblk) {
> nex = blkmap_getn(blkmap, dbno, mp->m_dirblkfsbs, &bmp, &lbmp);
> - ndbno = dbno + mp->m_dirblkfsbs - 1;
> + /* Advance through map to last dfs block in this dir block */
> + ndbno = dbno;
> + while (ndbno < dbno + mp->m_dirblkfsbs - 1) {
> + ndbno = blkmap_next_off(blkmap, ndbno, &t);
> + }
Yep, looks good to me. An important thing to notice is that blkmap_getn
handles all extents in a dir2 multiblock...
Reviewed-by: Ben Myers <bpm@sgi.com>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2012-06-01 20:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-21 22:07 [PATCH 0/3] xfs_repair fixes for fragmented multiblock v2 dirs Eric Sandeen
2012-05-21 22:10 ` [PATCH 1/3] xfs_repair: Fix fragmented multiblock dir2 handling in blkmap_getn() Eric Sandeen
2012-05-31 20:55 ` Ben Myers
2012-05-21 22:10 ` [PATCH 2/3] xfs_repair: Document & robustify blkmap_next_off() Eric Sandeen
2012-05-31 21:27 ` Ben Myers
2012-05-21 22:11 ` [PATCH 3/3] xfs_repair: handle fragmented multiblock dir2 in process_leaf_node_dir2() Eric Sandeen
2012-06-01 20:25 ` Ben Myers [this message]
2012-05-22 1:26 ` [PATCH 0/3] xfs_repair fixes for fragmented multiblock v2 dirs Eric Sandeen
2012-05-22 13:41 ` [PATCH 2/3 RESEND] " Eric Sandeen
2012-05-22 13:42 ` [PATCH 3/3 RESEND] xfs_repair: handle fragmented multiblock dir2 in process_leaf_node_dir2() Eric Sandeen
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=20120601202542.GL4721@sgi.com \
--to=bpm@sgi.com \
--cc=sandeen@redhat.com \
--cc=xfs@oss.sgi.com \
/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