From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs_db: consolidate set_iocur_type behavior
Date: Fri, 21 Aug 2020 07:52:10 -0700 [thread overview]
Message-ID: <20200821145210.GM6096@magnolia> (raw)
In-Reply-To: <8062b2d0-3fbb-0240-d5dd-c7bfb452f0b3@redhat.com>
On Thu, Aug 20, 2020 at 07:09:45PM -0500, Eric Sandeen wrote:
> Right now there are 3 cases to type_f: inode type, type with fields,
> and a default. The first two were added to address issues with handling
> V5 metadata.
>
> The first two already use some version of set_cur, which handles all
> of the validation etc. There's no reason to leave the open-coded bits
> at the end, just send every non-inode type through set_cur and be done
> with it.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> io.c | 28 +++++-----------------------
> 1 file changed, 5 insertions(+), 23 deletions(-)
>
> diff --git a/db/io.c b/db/io.c
> index 884da599..235191f5 100644
> --- a/db/io.c
> +++ b/db/io.c
> @@ -603,33 +603,15 @@ set_iocur_type(
> iocur_top->boff / mp->m_sb.sb_inodesize);
> ino = XFS_AGINO_TO_INO(mp, xfs_daddr_to_agno(mp, b), agino);
> set_cur_inode(ino);
> - return;
> - }
> -
> - /* adjust buffer size for types with fields & hence fsize() */
> - if (type->fields) {
> - int bb_count; /* type's size in basic blocks */
> + } else {
Two spaces ^^ between the else and the paren.
I also wonder, why not leave the "return;" at the end of the
"if (type->typnm == TYP_INODE)" part and then you can reduce the
indenting level of the rest of the function?
<shrug> maintainer's prerogative on that one though.
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
/me also wonders why dquots don't get the same "save the buffer offset"
treatment as inodes, but that's a separate question. :)
--D
> + int bb_count = 1; /* type's size in basic blocks */
>
> - bb_count = BTOBB(byteize(fsize(type->fields,
> + /* adjust buffer size for types with fields & hence fsize() */
> + if (type->fields)
> + bb_count = BTOBB(byteize(fsize(type->fields,
> iocur_top->data, 0, 0)));
> set_cur(type, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
> }
> - iocur_top->typ = type;
> -
> - /* verify the buffer if the type has one. */
> - if (!bp)
> - return;
> - if (!type->bops) {
> - bp->b_ops = NULL;
> - bp->b_flags |= LIBXFS_B_UNCHECKED;
> - return;
> - }
> - if (!(bp->b_flags & LIBXFS_B_UPTODATE))
> - return;
> - bp->b_error = 0;
> - bp->b_ops = type->bops;
> - bp->b_ops->verify_read(bp);
> - bp->b_flags &= ~LIBXFS_B_UNCHECKED;
> }
>
> static void
>
next prev parent reply other threads:[~2020-08-21 14:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 23:44 [PATCH 0/2] xfs_db: more type_f cleanups Eric Sandeen
2020-08-21 0:05 ` [PATCH 1/2] xfs_db: short circuit type_f if type is unchanged Eric Sandeen
2020-08-21 14:46 ` Darrick J. Wong
2020-08-21 15:46 ` Eric Sandeen
2020-08-21 0:09 ` [PATCH 2/2] xfs_db: consolidate set_iocur_type behavior Eric Sandeen
2020-08-21 14:52 ` Darrick J. Wong [this message]
2020-08-21 15:48 ` Eric Sandeen
2020-08-24 16:51 ` [PATCH 2/2 V2] xfs_db: consolidate set_iocur_type() behavior Eric Sandeen
2020-08-24 17:03 ` Darrick J. Wong
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=20200821145210.GM6096@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.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