[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1543376991-5764-5-git-send-email-allison.henderson@oracle.com>
Date: Tue, 27 Nov 2018 20:49:48 -0700
From: Allison Henderson <allison.henderson@...cle.com>
To: linux-block@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Cc: martin.petersen@...cle.com, shirley.ma@...cle.com,
bob.liu@...cle.com, allison.henderson@...cle.com
Subject: [PATCH v1 4/7] xfs: Add b_rw_hint to xfs_buf
This patch adds a new field b_rw_hint to xfs_buf. We will
need this to properly initialize the new bio->bi_rw_hint when
submitting the read request. When the read completes, we
then store the returned mirror in the b_rw_hint.
Signed-off-by: Allison Henderson <allison.henderson@...cle.com>
---
fs/xfs/xfs_buf.c | 5 ++++-
fs/xfs/xfs_buf.h | 7 +++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index b21ea2b..dd8ba59 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1322,8 +1322,10 @@ xfs_buf_bio_end_io(
if (!bp->b_error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ))
invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp));
- if (atomic_dec_and_test(&bp->b_io_remaining) == 1)
+ if (atomic_dec_and_test(&bp->b_io_remaining) == 1) {
+ bp->b_rw_hint = bio->bi_rw_hint;
xfs_buf_ioend_async(bp);
+ }
bio_put(bio);
}
@@ -1369,6 +1371,7 @@ xfs_buf_ioapply_map(
bio->bi_iter.bi_sector = sector;
bio->bi_end_io = xfs_buf_bio_end_io;
bio->bi_private = bp;
+ bio->bi_rw_hint = bp->b_rw_hint;
bio_set_op_attrs(bio, op, op_flags);
for (; size && nr_pages; nr_pages--, page_index++) {
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index b9f5511..db138e5 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -197,6 +197,13 @@ typedef struct xfs_buf {
unsigned long b_first_retry_time; /* in jiffies */
int b_last_error;
+ /*
+ * If b_rw_hint is set before a read, it specifies an alternate mirror
+ * to read from. Upon bio completion, b_rw_hint stores the last mirror
+ * that was read from
+ */
+ unsigned short b_rw_hint;
+
const struct xfs_buf_ops *b_ops;
} xfs_buf_t;
--
2.7.4
Powered by blists - more mailing lists