From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH v5 04/11] xfs: update inode allocation/free transaction reservations for finobt
Date: Thu, 24 Apr 2014 15:32:59 +1000 [thread overview]
Message-ID: <20140424053259.GA15995@dastard> (raw)
In-Reply-To: <1397146116-42546-5-git-send-email-bfoster@redhat.com>
On Thu, Apr 10, 2014 at 12:08:29PM -0400, Brian Foster wrote:
> Create the xfs_calc_finobt_res() helper to calculate the finobt log
> reservation for inode allocation and free. Update
> XFS_IALLOC_SPACE_RES() to reserve blocks for the additional finobt
> insertion on inode allocation. Create XFS_IFREE_SPACE_RES() to
> reserve blocks for the potential finobt record insertion on inode
> free (i.e., if an inode chunk was previously fully allocated).
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
> fs/xfs/xfs_inode.c | 25 ++++++++++++++++++++++-
> fs/xfs/xfs_trans_resv.c | 53 +++++++++++++++++++++++++++++++++++++++++++++---
> fs/xfs/xfs_trans_space.h | 7 ++++++-
> 3 files changed, 80 insertions(+), 5 deletions(-)
>
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 5e7a38f..8576892 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -1837,8 +1837,31 @@ xfs_inactive_ifree(
> int error;
>
> tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE);
> - error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ifree, 0, 0);
> +
> + /*
> + * The ifree transaction might need to allocate blocks for record
> + * insertion to the finobt. We don't want to fail here at ENOSPC, so
> + * allow ifree to dip into the reserved block pool if necessary.
> + *
> + * Freeing large sets of inodes generally means freeing inode chunks,
> + * directory and file data blocks, so this should be relatively safe.
> + * Only under severe circumstances should it be possible to free enough
> + * inodes to exhaust the reserve block pool via finobt expansion while
> + * at the same time not creating free space in the filesystem.
> + *
> + * Send a warning if the reservation does happen to fail, as the inode
> + * now remains allocated and sits on the unlinked list until the fs is
> + * repaired.
> + */
> + tp->t_flags |= XFS_TRANS_RESERVE;
> + error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ifree,
> + XFS_IFREE_SPACE_RES(mp), 0);
> if (error) {
> + if (error == ENOSPC)
> + xfs_warn_ratelimited(mp,
> + "Failed to remove inode(s) from unlinked list. "
> + "Please free space, unmount and run xfs_repair.");
> +
> ASSERT(XFS_FORCED_SHUTDOWN(mp));
> xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES);
> return error;
Comment is good, but if we get an ENOSPC error here we won't be in a
shutdown state, hence the assert needs fixing (i.e. else {assert})
Otherwise this looks good.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-04-24 5:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 16:08 [PATCH v5 00/11] xfs: introduce the free inode btree Brian Foster
2014-04-10 16:08 ` [PATCH v5 01/11] xfs: refactor xfs_ialloc_btree.c to support multiple inobt numbers Brian Foster
2014-04-10 16:08 ` [PATCH v5 02/11] xfs: reserve v5 superblock read-only compat. feature bit for finobt Brian Foster
2014-04-10 16:08 ` [PATCH v5 03/11] xfs: support the XFS_BTNUM_FINOBT free inode btree type Brian Foster
2014-04-24 5:27 ` Dave Chinner
2014-04-24 11:28 ` Brian Foster
2014-04-10 16:08 ` [PATCH v5 04/11] xfs: update inode allocation/free transaction reservations for finobt Brian Foster
2014-04-24 5:32 ` Dave Chinner [this message]
2014-04-24 11:29 ` Brian Foster
2014-04-10 16:08 ` [PATCH v5 05/11] xfs: insert newly allocated inode chunks into the finobt Brian Foster
2014-04-10 16:08 ` [PATCH v5 06/11] xfs: use and update the finobt on inode allocation Brian Foster
2014-04-24 5:44 ` Dave Chinner
2014-04-10 16:08 ` [PATCH v5 07/11] xfs: refactor xfs_difree() inobt bits into xfs_difree_inobt() helper Brian Foster
2014-04-10 16:08 ` [PATCH v5 08/11] xfs: update the finobt on inode free Brian Foster
2014-04-24 5:47 ` Dave Chinner
2014-04-10 16:08 ` [PATCH v5 09/11] xfs: add finobt support to growfs Brian Foster
2014-04-10 16:08 ` [PATCH v5 10/11] xfs: report finobt status in fs geometry Brian Foster
2014-04-10 16:08 ` [PATCH v5 11/11] xfs: enable the finobt feature on v5 superblocks Brian Foster
2014-04-14 9:46 ` [PATCH v5 00/11] xfs: introduce the free inode btree Dave Chinner
2014-04-24 5:51 ` Dave Chinner
2014-04-24 11:30 ` 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=20140424053259.GA15995@dastard \
--to=david@fromorbit.com \
--cc=bfoster@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.