From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 6/7] xfs: Use inode create transaction
Date: Tue, 7 May 2013 18:04:35 +1000 [thread overview]
Message-ID: <1367913876-30086-7-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1367913876-30086-1-git-send-email-david@fromorbit.com>
Replace the use of buffer based logging of inode initialisation,
uses the new logical form to describe the range to be initialised
in recovery. We continue to "log" the inode buffers to push them
into the AIL and ensure that the inode create transaction is not
removed from the log before the inode buffers are written to disk.
Update the transaction identifier and reservations to match the
changed implementation.
Signed-off-by: Dave Chinner <david@fromorbit.com>
---
fs/xfs/xfs_ialloc.c | 39 ++++++++++++++++++++++++++++++---------
fs/xfs/xfs_ialloc.h | 7 +++++++
2 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index c8f5ae1..9126b59 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -38,6 +38,7 @@
#include "xfs_bmap.h"
#include "xfs_cksum.h"
#include "xfs_buf_item.h"
+#include "xfs_icreate_item.h"
/*
@@ -152,7 +153,7 @@ xfs_check_agi_freecount(
/*
* Initialise a new set of inodes.
*/
-STATIC int
+int
xfs_ialloc_inode_init(
struct xfs_mount *mp,
struct xfs_trans *tp,
@@ -208,6 +209,17 @@ xfs_ialloc_inode_init(
version = 3;
ino = XFS_AGINO_TO_INO(mp, agno,
XFS_OFFBNO_TO_AGINO(mp, agbno, 0));
+
+ /*
+ * log the initialisation that is about to take place as an
+ * logical operation. This means the transaction does not
+ * need to log the physical changes to the inode buffers as log
+ * recovery will know what initialisation is actually needed.
+ * Hence we only need to log the buffers as "ordered" buffers so
+ * they track in the AIL as if they were physically logged.
+ */
+ xfs_icreate_log(tp, agno, agbno, XFS_IALLOC_INODES(mp),
+ mp->m_sb.sb_inodesize, length, gen);
} else if (xfs_sb_version_hasnlink(&mp->m_sb))
version = 2;
else
@@ -223,13 +235,8 @@ xfs_ialloc_inode_init(
XBF_UNMAPPED);
if (!fbuf)
return ENOMEM;
- /*
- * Initialize all inodes in this buffer and then log them.
- *
- * XXX: It would be much better if we had just one transaction
- * to log a whole cluster of inodes instead of all the
- * individual transactions causing a lot of log traffic.
- */
+
+ /* Initialize the inode buffers and log them appropriately. */
fbuf->b_ops = &xfs_inode_buf_ops;
xfs_buf_zero(fbuf, 0, BBTOB(fbuf->b_length));
for (i = 0; i < ninodes; i++) {
@@ -253,11 +260,25 @@ xfs_ialloc_inode_init(
ioffset + isize - 1);
}
}
+
if (version == 3) {
- /* need to log the entire buffer */
+ /*
+ * Mark the buffer as ordered so that it is not logged
+ * in the transaction but still tracked in the AIL as
+ * part of the transaction.
+ */
+ xfs_trans_ordered_buf(tp, fbuf);
xfs_trans_log_buf(tp, fbuf, 0,
BBTOB(fbuf->b_length) - 1);
}
+
+ /*
+ * Mark the buffer as an inode allocation buffer so it sticks in
+ * AIL at the point of this allocation transaction. This ensures
+ * the they are on disk before the tail of the log can be moved
+ * past this transaction (i.e. by preventing relogging from
+ * moving it forward in the log).
+ */
xfs_trans_inode_alloc_buf(tp, fbuf);
}
return 0;
diff --git a/fs/xfs/xfs_ialloc.h b/fs/xfs/xfs_ialloc.h
index c8da3df..ec1cc48 100644
--- a/fs/xfs/xfs_ialloc.h
+++ b/fs/xfs/xfs_ialloc.h
@@ -152,4 +152,11 @@ int xfs_inobt_get_rec(struct xfs_btree_cur *cur,
extern const struct xfs_buf_ops xfs_agi_buf_ops;
+/*
+ * Inode buffer initialisation routine
+ */
+int xfs_ialloc_inode_init(struct xfs_mount *mp, struct xfs_trans *tp,
+ xfs_agnumber_t agno, xfs_agblock_t agbno,
+ xfs_agblock_t length, unsigned int gen);
+
#endif /* __XFS_IALLOC_H__ */
--
1.7.10.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-05-07 8:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-07 8:04 [RFC, PATCH 0/7] xfs: new icreate transaction Dave Chinner
2013-05-07 8:04 ` [PATCH 1/7] xfs: don't do IO when creating an new inode Dave Chinner
2013-05-07 8:04 ` [PATCH 2/7] xfs: xfs_ifree doesn't need to modify the inode buffer Dave Chinner
2013-05-07 8:04 ` [PATCH 3/7] xfs: Introduce an ordered buffer item Dave Chinner
2013-05-07 8:04 ` [PATCH 4/7] xfs: Inode create log items Dave Chinner
2013-05-07 8:04 ` [PATCH 5/7] xfs: Inode create transaction reservations Dave Chinner
2013-05-07 8:04 ` Dave Chinner [this message]
2013-05-07 8:04 ` [PATCH 7/7] xfs: Inode create item recovery 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=1367913876-30086-7-git-send-email-david@fromorbit.com \
--to=david@fromorbit.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox