From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/6] libfrog: create online fs geometry converters
Date: Tue, 27 Aug 2019 17:11:06 +1000 [thread overview]
Message-ID: <20190827071106.GD1119@dread.disaster.area> (raw)
In-Reply-To: <156633305717.1215733.17610092313024714477.stgit@magnolia>
On Tue, Aug 20, 2019 at 01:30:57PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Create helper functions to perform unit conversions against a runtime
> filesystem, then remove the open-coded versions in scrub.
.... and there they are...
> +/* Convert fs block number into bytes */
> +static inline uint64_t
> +xfrog_fsb_to_b(
> + const struct xfs_fd *xfd,
> + uint64_t fsb)
> +{
> + return fsb << xfd->blocklog;
> +}
FWIW, this is for converting linear offsets in fsb /units/, not the
sparse fsbno (= agno | agbno) to bytes. I've always found it a bit
nasty that this distinction is not clearly made in the core FSB
conversion macros.
perhaps off_fsb_to_b?
> +/* Convert bytes into (rounded down) fs block number */
> +static inline uint64_t
> +xfrog_b_to_fsbt(
> + const struct xfs_fd *xfd,
> + uint64_t bytes)
> +{
> + return bytes >> xfd->blocklog;
> +}
Ditto.
Otherwise looks ok.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2019-08-27 7:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 20:30 [PATCH 0/6] libxfrog: wrap version ioctl calls Darrick J. Wong
2019-08-20 20:30 ` [PATCH 1/6] libfrog: refactor online geometry queries Darrick J. Wong
2019-08-27 6:30 ` Dave Chinner
2019-08-28 17:08 ` Darrick J. Wong
2019-08-20 20:30 ` [PATCH 2/6] libfrog: introduce xfs_fd to wrap an fd to a file on an xfs filesystem Darrick J. Wong
2019-08-27 6:41 ` Dave Chinner
2019-08-28 17:15 ` Darrick J. Wong
2019-08-20 20:30 ` [PATCH 3/6] libfrog: store more inode and block geometry in struct xfs_fd Darrick J. Wong
2019-08-27 7:00 ` Dave Chinner
2019-08-20 20:30 ` [PATCH 4/6] libfrog: create online fs geometry converters Darrick J. Wong
2019-08-27 7:11 ` Dave Chinner [this message]
2019-08-28 17:35 ` Darrick J. Wong
2019-08-20 20:31 ` [PATCH 5/6] libfrog: refactor open-coded bulkstat calls Darrick J. Wong
2019-08-27 7:25 ` Dave Chinner
2019-08-20 20:31 ` [PATCH 6/6] libfrog: refactor open-coded INUMBERS calls Darrick J. Wong
2019-08-27 7:26 ` Dave Chinner
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=20190827071106.GD1119@dread.disaster.area \
--to=david@fromorbit.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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).