xfs
[Top] [All Lists]

***** SUSPECTED SPAM ***** [RFD 01/17] xfs: inode allocation tickets

To: xfs@xxxxxxxxxxx
Subject: ***** SUSPECTED SPAM ***** [RFD 01/17] xfs: inode allocation tickets
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Mon, 12 Aug 2013 23:19:51 +1000
Delivered-to: xfs@xxxxxxxxxxx
Importance: Low
In-reply-to: <1376313607-28133-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1376313607-28133-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

If we want to split inode allocation up into a background chunk allocator and an
indvidual free inode allocator, then we need to be able to guarantee that a free
inode will be available before we take a log reservation for the free inode
allocation.

If we don't guarantee that we can allocate an inode before we reserve log space
for the individual inode allocation, then we may reserve all the remaining log
space for the free inode allocation and then not be able to reserve space for
a ne winode chunk allocation in the log. This will cause an inode allocation
deadlock.

To avoid this deadlock, use a ticket system to guarantee an allocation has a
reserved free inode before it proceeds to the transaction reservation for the
allocation. This allows the free inode allocation to block waiting for
background allocation to allocate more inode chunks in a sane and rational
manner.

The ticket system needs to be a per-allocation group ticket, as inodes are
allocated and tracked at a per-AG granularity. Hence we need to restructure the
inode allocation code to select an AG for the new inode as early as possible
and then take a ticket on that AG. It is entirely possible that we can then get
an ENOSPC error for the inode chunk allocation, so we must be able to fall all
the way back to this ticket allocation loop to try another AG in this case.
Hauling this AG selection loop out of the internal free inode allocation code
might be sufficiently complex to warrant multiple setup patches by itself....

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
---
 fs/xfs/xfs_ialloc.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_ialloc.h b/fs/xfs/xfs_ialloc.h
index 68c0732..1da16f5 100644
--- a/fs/xfs/xfs_ialloc.h
+++ b/fs/xfs/xfs_ialloc.h
@@ -24,6 +24,8 @@ struct xfs_imap;
 struct xfs_mount;
 struct xfs_trans;
 
+struct xfs_ialloc_ticket;
+
 /*
  * Allocation parameters for inode allocation.
  */
-- 
1.8.3.2

<Prev in Thread] Current Thread [Next in Thread>