summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_buf_item.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2020-06-30 00:48:48 +0300
committerDarrick J. Wong <darrick.wong@oracle.com>2020-07-06 20:46:59 +0300
commitaac855ab1a98d9c20762047f26af47d391c3ba7a (patch)
tree973febf52b61413b35f31cf53557d7ff2de8a75f /fs/xfs/xfs_buf_item.c
parenta7e134ef37172fd4f13bbb11f8f440c807ba294b (diff)
downloadlinux-aac855ab1a98d9c20762047f26af47d391c3ba7a.tar.xz
xfs: make inode IO completion buffer centric
Having different io completion callbacks for different inode states makes things complex. We can detect if the inode is stale via the XFS_ISTALE flag in IO completion, so we don't need a special callback just for this. This means inodes only have a single iodone callback, and inode IO completion is entirely buffer centric at this point. Hence we no longer need to use a log item callback at all as we can just call xfs_iflush_done() directly from the buffer completions and walk the buffer log item list to complete the all inodes under IO. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_buf_item.c')
-rw-r--r--fs/xfs/xfs_buf_item.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 5b3cd5e90947..a4e416af5c61 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -13,6 +13,8 @@
#include "xfs_mount.h"
#include "xfs_trans.h"
#include "xfs_buf_item.h"
+#include "xfs_inode.h"
+#include "xfs_inode_item.h"
#include "xfs_trans_priv.h"
#include "xfs_trace.h"
#include "xfs_log.h"
@@ -457,7 +459,8 @@ xfs_buf_item_unpin(
* the AIL lock.
*/
if (bip->bli_flags & XFS_BLI_STALE_INODE) {
- xfs_buf_do_callbacks(bp);
+ lip->li_cb(bp, lip);
+ xfs_iflush_done(bp);
bp->b_log_item = NULL;
} else {
xfs_trans_ail_delete(lip, SHUTDOWN_LOG_IO_ERROR);
@@ -1141,8 +1144,8 @@ out_stale:
return false;
}
-static void
-xfs_buf_run_callbacks(
+static inline bool
+xfs_buf_had_callback_errors(
struct xfs_buf *bp)
{
@@ -1152,7 +1155,7 @@ xfs_buf_run_callbacks(
* appropriate action.
*/
if (bp->b_error && xfs_buf_iodone_callback_error(bp))
- return;
+ return true;
/*
* Successful IO or permanent error. Either way, we can clear the
@@ -1161,7 +1164,16 @@ xfs_buf_run_callbacks(
bp->b_last_error = 0;
bp->b_retries = 0;
bp->b_first_retry_time = 0;
+ return false;
+}
+static void
+xfs_buf_run_callbacks(
+ struct xfs_buf *bp)
+{
+
+ if (xfs_buf_had_callback_errors(bp))
+ return;
xfs_buf_do_callbacks(bp);
bp->b_log_item = NULL;
}
@@ -1173,7 +1185,20 @@ void
xfs_buf_inode_iodone(
struct xfs_buf *bp)
{
- xfs_buf_run_callbacks(bp);
+ struct xfs_buf_log_item *blip = bp->b_log_item;
+ struct xfs_log_item *lip;
+
+ if (xfs_buf_had_callback_errors(bp))
+ return;
+
+ /* If there is a buf_log_item attached, run its callback */
+ if (blip) {
+ lip = &blip->bli_item;
+ lip->li_cb(bp, lip);
+ bp->b_log_item = NULL;
+ }
+
+ xfs_iflush_done(bp);
xfs_buf_ioend_finish(bp);
}