From: Alex Elder <aelder@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 08/25] xfs: introduce xfs_bmapi_delay()
Date: Fri, 2 Sep 2011 17:23:58 -0500 [thread overview]
Message-ID: <1315002238.2069.88.camel@doink> (raw)
In-Reply-To: <20110824060641.979845427@bombadil.infradead.org>
On Wed, 2011-08-24 at 02:04 -0400, Christoph Hellwig wrote:
> plain text document attachment (xfs-bmapi-add-xfs_bmapi_delay)
> Delalloc reservations are much simpler than allocations, so give them a
> separate bmapi-level interface. Using the previously added
> xfs_bmapi_reserve_delalloc we get a function that is only minimally
> more complicated than xfs_bmapi_read, which is far from the complexity
> in xfs_bmapi. Also remove the XFS_BMAPI_DELAY code after switching
> over the only user to xfs_bmapi_delay.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
I have a minor suggestion but it's not worth
rejecting this over. Also a question. But
regardless, this looks good:
Reviewed-by: Alex Elder <aelder@sgi.com>
I'm out of time today. I will have to continue
later.
> Index: xfs/fs/xfs/xfs_bmap.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_bmap.c 2011-08-23 21:12:56.272619118 +0200
> +++ xfs/fs/xfs/xfs_bmap.c 2011-08-23 21:12:59.355935746 +0200
> @@ -4238,7 +4238,7 @@ xfs_bmap_validate_ret(
> ASSERT(i == 0 ||
> mval[i - 1].br_startoff + mval[i - 1].br_blockcount ==
> mval[i].br_startoff);
> - if ((flags & XFS_BMAPI_WRITE) && !(flags & XFS_BMAPI_DELAY))
> + if (flags & XFS_BMAPI_WRITE)
> ASSERT(mval[i].br_startblock != DELAYSTARTBLOCK &&
> mval[i].br_startblock != HOLESTARTBLOCK);
> ASSERT(mval[i].br_state == XFS_EXT_NORM ||
> @@ -4553,6 +4553,90 @@ out_unreserve_quota:
> }
>
> /*
> + * Map file blocks to filesystem blocks, adding delayed allocations as needed.
> + */
> +int
> +xfs_bmapi_delay(
> + struct xfs_inode *ip, /* incore inode */
> + xfs_fileoff_t bno, /* starting file offs. mapped */
> + xfs_filblks_t len, /* length to map in file */
> + struct xfs_bmbt_irec *mval, /* output: map values */
> + int *nmap, /* i/o: mval size/count */
> + int flags) /* XFS_BMAPI_... */
> +{
> + struct xfs_mount *mp = ip->i_mount;
> + struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
> + struct xfs_bmbt_irec got; /* current file extent record */
> + struct xfs_bmbt_irec prev; /* previous file extent record */
> + xfs_fileoff_t obno; /* old block number (offset) */
> + xfs_fileoff_t end; /* end of mapped file region */
> + xfs_extnum_t lastx; /* last useful extent number */
> + int eof; /* we've hit the end of extents */
> + int n = 0; /* current extent index */
> + int error = 0;
> +
> + ASSERT(*nmap >= 1);
> + ASSERT(*nmap <= XFS_BMAP_MAX_NMAP);
> + ASSERT(!(flags & ~XFS_BMAPI_ENTIRE));
> +
Rearrange the following test to use the pattern (assigning error)
used in xfs_bmapi_read().
> + if (unlikely(XFS_TEST_ERROR(
> + (XFS_IFORK_FORMAT(ip, XFS_DATA_FORK) != XFS_DINODE_FMT_EXTENTS &&
> + XFS_IFORK_FORMAT(ip, XFS_DATA_FORK) != XFS_DINODE_FMT_BTREE),
Are you certain that XFS_DINODE_FMT_LOCAL is not possible here?
I tried to trace it back but I'm still not sure. The transaction
pointer passed is null, so it would have tripped an assertion
in the previous code. (A simple explanation would reassure me.)
> + mp, XFS_ERRTAG_BMAPIFORMAT, XFS_RANDOM_BMAPIFORMAT))) {
> + XFS_ERROR_REPORT("xfs_bmapi_delay", XFS_ERRLEVEL_LOW, mp);
> + return XFS_ERROR(EFSCORRUPTED);
> + }
> +
> + if (XFS_FORCED_SHUTDOWN(mp))
> + return XFS_ERROR(EIO);
> +
> + XFS_STATS_INC(xs_blk_mapw);
> +
> +
. . .
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-09-06 15:19 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-24 6:04 [PATCH 00/25] xfs_bmapi split and cleanups Christoph Hellwig
2011-08-24 6:04 ` [PATCH 01/25] xfs: remove the first extent special case in xfs_bmap_add_extent Christoph Hellwig
2011-09-02 22:22 ` Alex Elder
2011-09-06 11:52 ` Christoph Hellwig
2011-08-24 6:04 ` [PATCH 02/25] xfs: remove impossible to read code in xfs_bmap_add_extent_delay_real Christoph Hellwig
2011-09-02 22:23 ` Alex Elder
2011-08-24 6:04 ` [PATCH 03/25] xfs: remove the nextents variable in xfs_bmapi Christoph Hellwig
2011-09-02 22:23 ` Alex Elder
2011-08-24 6:04 ` [PATCH 04/25] xfs: factor extent map manipulations out of xfs_bmapi Christoph Hellwig
2011-09-02 22:23 ` Alex Elder
2011-09-06 11:55 ` Christoph Hellwig
2011-09-07 17:21 ` Alex Elder
2011-09-07 17:23 ` Christoph Hellwig
2011-08-24 6:04 ` [PATCH 05/25] xfs: introduce xfs_bmapi_read() Christoph Hellwig
2011-09-02 22:23 ` Alex Elder
2011-08-24 6:04 ` [PATCH 06/25] xfs: remove xfs_bmapi_single() Christoph Hellwig
2011-09-02 22:23 ` Alex Elder
2011-08-24 6:04 ` [PATCH 07/25] xfs: factor delalloc reservations out of xfs_bmapi Christoph Hellwig
2011-09-02 22:23 ` Alex Elder
2011-08-24 6:04 ` [PATCH 08/25] xfs: introduce xfs_bmapi_delay() Christoph Hellwig
2011-09-02 22:23 ` Alex Elder [this message]
2011-09-06 15:27 ` Christoph Hellwig
2011-09-07 17:21 ` Alex Elder
2011-08-24 6:04 ` [PATCH 09/25] xfs: do not use xfs_bmap_add_extent for adding delalloc extents Christoph Hellwig
2011-09-09 20:23 ` Alex Elder
2011-08-24 6:04 ` [PATCH 10/25] xfs: factor extent allocation out of xfs_bmapi Christoph Hellwig
2011-09-09 20:23 ` Alex Elder
2011-09-11 11:50 ` Christoph Hellwig
2011-08-24 6:04 ` [PATCH 11/25] xfs: factor unwritten extent map manipulations " Christoph Hellwig
2011-09-09 20:23 ` Alex Elder
2011-08-24 6:04 ` [PATCH 12/25] xfs: rename xfs_bmapi to xfs_bmapi_write Christoph Hellwig
2011-09-09 20:23 ` Alex Elder
2011-08-24 6:04 ` [PATCH 13/25] xfs: introduce xfs_bmap_last_extent Christoph Hellwig
2011-09-09 20:23 ` Alex Elder
2011-09-10 18:45 ` Christoph Hellwig
2011-08-24 6:04 ` [PATCH 14/25] xfs: remove xfs_bmap_add_extent Christoph Hellwig
2011-09-09 23:55 ` Alex Elder
2011-09-10 18:49 ` Christoph Hellwig
2011-08-24 6:04 ` [PATCH 15/25] xfs: pass bmalloca structure to xfs_bmap_isaeof Christoph Hellwig
2011-09-09 23:55 ` Alex Elder
2011-09-10 18:52 ` Christoph Hellwig
2011-08-24 6:04 ` [PATCH 16/25] xfs: move extent records into bmalloca structure Christoph Hellwig
2011-09-09 23:55 ` Alex Elder
2011-08-24 6:04 ` [PATCH 17/25] xfs: move firstblock and bmap freelist cursor " Christoph Hellwig
2011-09-09 23:56 ` Alex Elder
2011-08-24 6:04 ` [PATCH 18/25] xfs: move allocation ranges inode " Christoph Hellwig
2011-09-09 23:56 ` Alex Elder
2011-09-10 18:57 ` Christoph Hellwig
2011-08-24 6:04 ` [PATCH 19/25] xfs: move btree cursor into bmalloca Christoph Hellwig
2011-09-09 23:56 ` Alex Elder
2011-08-24 6:04 ` [PATCH 20/25] xfs: move lastx and nallocs " Christoph Hellwig
2011-09-09 23:56 ` Alex Elder
2011-08-24 6:04 ` [PATCH 21/25] xfs: move logflags " Christoph Hellwig
2011-09-09 23:56 ` Alex Elder
2011-08-24 6:04 ` [PATCH 22/25] xfs: pass bmalloca to xfs_bmap_add_extent_delay_real Christoph Hellwig
2011-09-09 23:56 ` Alex Elder
2011-08-24 6:04 ` [PATCH 23/25] xfs: pass bmalloca to xfs_bmap_add_extent_hole_real Christoph Hellwig
2011-09-09 23:58 ` Alex Elder
2011-08-24 6:04 ` [PATCH 24/25] xfs: dont ignore error code from xfs_bmbt_update Christoph Hellwig
2011-09-09 23:58 ` Alex Elder
2011-08-24 6:04 ` [PATCH 25/25] xfs: cleanup xfs_bmap.h Christoph Hellwig
2011-09-09 23:58 ` Alex Elder
2011-08-24 6:42 ` [PATCH 00/25] xfs_bmapi split and cleanups Christoph Hellwig
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=1315002238.2069.88.camel@doink \
--to=aelder@sgi.com \
--cc=hch@infradead.org \
--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