From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 07/10] xfs: fix space reservation in xfs_bmbt_alloc_block
Date: Mon, 17 Apr 2017 10:19:44 -0400 [thread overview]
Message-ID: <20170417141943.GE41659@bfoster.bfoster> (raw)
In-Reply-To: <20170413080517.12564-8-hch@lst.de>
On Thu, Apr 13, 2017 at 10:05:14AM +0200, Christoph Hellwig wrote:
> minleft counts the number of blocks that need to be available after the
> current allocation has been completed. As the total allocation should not
> be more than the transaction reservation we need to subtract the
> allocation length. In addition we need to subtract the already used
> transaction reservation, for that use the new xfs_trans_blk_res helper.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/libxfs/xfs_bmap_btree.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c
> index ce41dd5fbb34..153c969febd4 100644
> --- a/fs/xfs/libxfs/xfs_bmap_btree.c
> +++ b/fs/xfs/libxfs/xfs_bmap_btree.c
> @@ -442,6 +442,7 @@ xfs_bmbt_alloc_block(
> args.mp = cur->bc_mp;
> args.fsbno = cur->bc_private.b.firstblock;
> args.firstblock = args.fsbno;
> + args.minlen = args.maxlen = args.prod = 1;
> xfs_rmap_ino_bmbt_owner(&args.oinfo, cur->bc_private.b.ip->i_ino,
> cur->bc_private.b.whichfork);
>
> @@ -459,14 +460,14 @@ xfs_bmbt_alloc_block(
> * reservation amount is insufficient then we may fail a
> * block allocation here and corrupt the filesystem.
> */
> - args.minleft = args.tp->t_blk_res;
> + if (xfs_trans_blk_res(args.tp))
> + args.minleft = xfs_trans_blk_res(args.tp) - args.maxlen;
> } else if (cur->bc_private.b.dfops->dop_low) {
> args.type = XFS_ALLOCTYPE_START_BNO;
> } else {
> args.type = XFS_ALLOCTYPE_NEAR_BNO;
> }
>
> - args.minlen = args.maxlen = args.prod = 1;
> args.wasdel = cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL;
> if (!args.wasdel && args.tp->t_blk_res == 0) {
> error = -ENOSPC;
> --
> 2.11.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-04-17 14:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-13 8:05 fix space reservations underneath xfs_bmapi_write Christoph Hellwig
2017-04-13 8:05 ` [PATCH 01/10] xfs: introduce xfs_trans_blk_res Christoph Hellwig
2017-04-13 18:28 ` Brian Foster
2017-04-13 8:05 ` [PATCH 02/10] xfs: rewrite xfs_da_grow_inode_int Christoph Hellwig
2017-04-13 18:28 ` Brian Foster
2017-04-13 8:05 ` [PATCH 03/10] xfs: remove the XFS_BMAPI_CONTIG flag Christoph Hellwig
2017-04-13 18:28 ` Brian Foster
2017-04-13 8:05 ` [PATCH 04/10] xfs: remove an unsafe retry in xfs_bmbt_alloc_block Christoph Hellwig
2017-04-13 18:30 ` Brian Foster
2017-04-14 7:46 ` Christoph Hellwig
2017-04-17 14:19 ` Brian Foster
2017-04-18 7:54 ` Christoph Hellwig
2017-04-18 14:18 ` Brian Foster
2017-04-25 7:30 ` Christoph Hellwig
2017-04-25 12:11 ` Brian Foster
2017-04-13 8:05 ` [PATCH 05/10] xfs: remove the total argument to xfs_bmap_local_to_extents Christoph Hellwig
2017-04-17 14:19 ` Brian Foster
2017-04-13 8:05 ` [PATCH 06/10] xfs: fix bmap minleft calculation Christoph Hellwig
2017-04-17 14:19 ` Brian Foster
2017-04-18 7:59 ` Christoph Hellwig
2017-04-13 8:05 ` [PATCH 07/10] xfs: fix space reservation in xfs_bmbt_alloc_block Christoph Hellwig
2017-04-17 14:19 ` Brian Foster [this message]
2017-04-13 8:05 ` [PATCH 08/10] xfs: introduce a XFS_BMAPI_BESTEFFORT flag Christoph Hellwig
2017-04-17 18:08 ` Brian Foster
2017-04-18 7:58 ` Christoph Hellwig
2017-04-18 14:18 ` Brian Foster
2017-04-13 8:05 ` [PATCH 09/10] xfs: kill the dop_low flag Christoph Hellwig
2017-04-17 18:08 ` Brian Foster
2017-04-13 8:05 ` [PATCH 10/10] xfs: remove xfs_bmap_alloc Christoph Hellwig
2017-04-17 18:08 ` Brian Foster
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=20170417141943.GE41659@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/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).