From: Brian Foster <bfoster@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 10/13] xfs_repair: Remove more differences between attr & dir2
Date: Mon, 14 Sep 2015 15:55:13 -0400 [thread overview]
Message-ID: <20150914195513.GK34083@bfoster.bfoster> (raw)
In-Reply-To: <1441827251-13128-11-git-send-email-sandeen@sandeen.net>
On Wed, Sep 09, 2015 at 02:34:08PM -0500, Eric Sandeen wrote:
> This is a hodgepodge of unrelated but not-completely-trivial
> chagnes to both the dir2 and attr code to make their common
> code more similar.
>
> * It removes the whichfork checking in attr_repair, because we
> only get there with XFS_ATTR_FORK.
> * It changes the magic-checking logic slightly to match.
> * It swaps some (bp == NULL) tests for (!bp)
>
> These should be purely cosmetic changes.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> repair/attr_repair.c | 20 +++++---------------
> repair/dir2.c | 14 ++++++++------
> 2 files changed, 13 insertions(+), 21 deletions(-)
>
> diff --git a/repair/attr_repair.c b/repair/attr_repair.c
> index c8ba484..26a0e71 100644
> --- a/repair/attr_repair.c
> +++ b/repair/attr_repair.c
> @@ -177,19 +177,13 @@ traverse_int_dablock(xfs_mount_t *mp,
> free(bmp);
>
> if (!bp) {
> - if (whichfork == XFS_DATA_FORK)
> - do_warn(
> - _("can't read block %u (fsbno %" PRIu64 ") for directory inode %" PRIu64 "\n"),
> - bno, fsbno, da_cursor->ino);
> - else
> - do_warn(
> + do_warn(
> _("can't read block %u (fsbno %" PRIu64 ") for attrbute fork of inode %" PRIu64 "\n"),
> bno, fsbno, da_cursor->ino);
> goto error_out;
> }
>
> node = bp->b_addr;
> - btree = M_DIROPS(mp)->node_tree_p(node);
> M_DIROPS(mp)->node_hdr_from_disk(&nodehdr, node);
>
> if (nodehdr.magic != XFS_DA_NODE_MAGIC &&
> @@ -210,6 +204,7 @@ _("corrupt tree block %u for directory inode %" PRIu64 "\n"),
> goto error_out;
> }
>
> + btree = M_DIROPS(mp)->node_tree_p(node);
> if (nodehdr.count > geo->node_ents) {
> do_warn(_("bad record count in inode %" PRIu64 ", "
> "count = %d, max = %d\n"),
> @@ -235,14 +230,9 @@ _("bad header depth for directory inode %" PRIu64 "\n"),
> if (nodehdr.level == i - 1) {
> i--;
> } else {
> - if (whichfork == XFS_DATA_FORK)
> - do_warn(_("bad directory btree for "
> - "directory inode %" PRIu64 "\n"),
> - da_cursor->ino);
> - else
> - do_warn(_("bad attribute fork btree "
> - "for inode %" PRIu64 "\n"),
> - da_cursor->ino);
> + do_warn(_("bad attribute fork btree "
> + "for inode %" PRIu64 "\n"),
> + da_cursor->ino);
> libxfs_putbuf(bp);
> goto error_out;
> }
> diff --git a/repair/dir2.c b/repair/dir2.c
> index 9398df5..8cf981f 100644
> --- a/repair/dir2.c
> +++ b/repair/dir2.c
> @@ -172,7 +172,7 @@ traverse_int_dir2block(xfs_mount_t *mp,
> bp = da_read_buf(mp, nex, bmp, &xfs_da3_node_buf_ops);
> if (bmp != &lbmp)
> free(bmp);
> - if (bp == NULL) {
> + if (!bp) {
> do_warn(
> _("can't read block %u for directory inode %" PRIu64 "\n"),
> bno, da_cursor->ino);
> @@ -192,8 +192,10 @@ _("found non-root LEAFN node in inode %" PRIu64 " bno = %u\n"),
> *rbno = 0;
> libxfs_putbuf(bp);
> return(1);
> - } else if (!(nodehdr.magic == XFS_DA_NODE_MAGIC ||
> - nodehdr.magic == XFS_DA3_NODE_MAGIC)) {
> + }
> +
> + if (nodehdr.magic != XFS_DA_NODE_MAGIC &&
> + nodehdr.magic != XFS_DA3_NODE_MAGIC) {
> libxfs_putbuf(bp);
> do_warn(
> _("bad dir magic number 0x%x in inode %" PRIu64 " bno = %u\n"),
> @@ -574,7 +576,7 @@ _("can't get map info for block %u of directory inode %" PRIu64 "\n"),
> if (bmp != &lbmp)
> free(bmp);
>
> - if (bp == NULL) {
> + if (!bp) {
> do_warn(
> _("can't read block %u for directory inode %" PRIu64 "\n"),
> dabno, cursor->ino);
> @@ -589,8 +591,8 @@ _("can't read block %u for directory inode %" PRIu64 "\n"),
> * entry count, verify level
> */
> bad = 0;
> - if (!(nodehdr.magic == XFS_DA_NODE_MAGIC ||
> - nodehdr.magic == XFS_DA3_NODE_MAGIC)) {
> + if (nodehdr.magic != XFS_DA_NODE_MAGIC &&
> + nodehdr.magic != XFS_DA3_NODE_MAGIC) {
> do_warn(
> _("bad magic number %x in block %u for directory inode %" PRIu64 "\n"),
> nodehdr.magic,
> --
> 1.7.1
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-09-14 19:55 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-09 19:33 [PATCH 0/13] xfs_repair: recombine cut&waste code in dir2.c/attr_repair.c Eric Sandeen
2015-09-09 19:33 ` [PATCH 01/13] xfs_repair: remove trace-only 'n' member from da_level_state Eric Sandeen
2015-09-14 19:17 ` Brian Foster
2015-09-09 19:34 ` [PATCH 02/13] xfs_repair: remove type from da & dir2 cursors Eric Sandeen
2015-09-14 19:18 ` Brian Foster
2015-09-09 19:34 ` [PATCH 03/13] xfs_repair: make CRC checking consistent in path verification Eric Sandeen
2015-09-14 19:18 ` Brian Foster
2015-09-09 19:34 ` [PATCH 04/13] xfs_repair: use multibuffer read routines in attr_repair.c Eric Sandeen
2015-09-14 19:18 ` Brian Foster
2015-09-14 19:24 ` Eric Sandeen
2015-09-14 19:30 ` Brian Foster
2015-09-09 19:34 ` [PATCH 05/13] xfs_repair: fix use-after-free in verify_final_dir2_path Eric Sandeen
2015-09-14 19:18 ` Brian Foster
2015-09-09 19:34 ` [PATCH 06/13] xfs_repair: add XR_DIR_TRACE to dir2.c Eric Sandeen
2015-09-14 19:18 ` Brian Foster
2015-09-09 19:34 ` [PATCH 07/13] xfs_repair: Remove BUF_PTR from attr_repair.c Eric Sandeen
2015-09-14 19:44 ` Brian Foster
2015-09-09 19:34 ` [PATCH 08/13] xfs_repair: catch bad level/depth in da node Eric Sandeen
2015-09-14 19:44 ` Brian Foster
2015-09-09 19:34 ` [PATCH 09/13] xfs_repair: better checking of v5 attributes Eric Sandeen
2015-09-14 19:44 ` Brian Foster
2015-09-23 17:53 ` Eric Sandeen
2015-09-09 19:34 ` [PATCH 10/13] xfs_repair: Remove more differences between attr & dir2 Eric Sandeen
2015-09-14 19:55 ` Brian Foster [this message]
2015-09-09 19:34 ` [PATCH 11/13] xfs_repair: whitespace & comments Eric Sandeen
2015-09-14 19:56 ` Brian Foster
2015-09-09 19:34 ` [PATCH 12/13] xfs_repair: move common dir2 and attr_repair code to da_util.c Eric Sandeen
2015-09-09 19:34 ` [PATCH 13/13] xfs_repair: Fix up warning strings in da_util.c Eric Sandeen
2015-09-14 20:06 ` Brian Foster
2015-09-14 20:11 ` Eric Sandeen
2015-09-10 9:22 ` [PATCH 0/13] xfs_repair: recombine cut&waste code in dir2.c/attr_repair.c Carlos Maiolino
2015-09-10 16:51 ` Eric Sandeen
2015-09-11 8:20 ` Carlos Maiolino
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=20150914195513.GK34083@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=sandeen@sandeen.net \
--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