From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 04/10] xfs: add discontiguous buffer map interface
Date: Tue, 24 Apr 2012 16:33:34 +1000 [thread overview]
Message-ID: <1335249220-22274-5-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1335249220-22274-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
With the internal interfaces supporting discontiguous buffer maps,
add external lookup, read and get interfaces so they can start to be
used.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_buf.c | 42 +++++++++++++++++++----------------------
fs/xfs/xfs_buf.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 68 insertions(+), 29 deletions(-)
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 1766edd..1503094 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -588,25 +588,21 @@ found:
* more hits than misses.
*/
struct xfs_buf *
-xfs_buf_get(
- xfs_buftarg_t *target,
- xfs_daddr_t blkno,
- size_t numblks,
+xfs_buf_get_map(
+ struct xfs_buftarg *target,
+ struct xfs_buf_map *map,
+ int nmaps,
xfs_buf_flags_t flags)
{
struct xfs_buf *bp;
struct xfs_buf *new_bp;
- struct xfs_buf_map map = {
- .bm_bn = blkno,
- .bm_len = numblks,
- };
int error = 0;
- bp = _xfs_buf_find(target, &map, 1, flags, NULL);
+ bp = _xfs_buf_find(target, map, nmaps, flags, NULL);
if (likely(bp))
goto found;
- new_bp = _xfs_buf_alloc(target, &map, 1, flags);
+ new_bp = _xfs_buf_alloc(target, map, nmaps, flags);
if (unlikely(!new_bp))
return NULL;
@@ -616,7 +612,7 @@ xfs_buf_get(
return NULL;
}
- bp = _xfs_buf_find(target, &map, 1, flags, new_bp);
+ bp = _xfs_buf_find(target, map, nmaps, flags, new_bp);
if (!bp) {
xfs_buf_free(new_bp);
return NULL;
@@ -629,7 +625,7 @@ xfs_buf_get(
* Now we have a workable buffer, fill in the block number so
* that we can do IO on it.
*/
- bp->b_bn = blkno;
+ bp->b_bn = map[0].bm_bn;
found:
if (!bp->b_addr) {
@@ -665,17 +661,17 @@ _xfs_buf_read(
}
xfs_buf_t *
-xfs_buf_read(
- xfs_buftarg_t *target,
- xfs_daddr_t blkno,
- size_t numblks,
+xfs_buf_read_map(
+ struct xfs_buftarg *target,
+ struct xfs_buf_map *map,
+ int nmaps,
xfs_buf_flags_t flags)
{
- xfs_buf_t *bp;
+ struct xfs_buf *bp;
flags |= XBF_READ;
- bp = xfs_buf_get(target, blkno, numblks, flags);
+ bp = xfs_buf_get_map(target, map, nmaps, flags);
if (bp) {
trace_xfs_buf_read(bp, flags, _RET_IP_);
@@ -703,15 +699,15 @@ xfs_buf_read(
* safe manner.
*/
void
-xfs_buf_readahead(
- xfs_buftarg_t *target,
- xfs_daddr_t blkno,
- size_t numblks)
+xfs_buf_readahead_map(
+ struct xfs_buftarg *target,
+ struct xfs_buf_map *map,
+ int nmaps)
{
if (bdi_read_congested(target->bt_bdi))
return;
- xfs_buf_read(target, blkno, numblks,
+ xfs_buf_read_map(target, map, nmaps,
XBF_TRYLOCK|XBF_ASYNC|XBF_READ_AHEAD);
}
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index 3de9e80..118d586 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -187,12 +187,55 @@ xfs_buf_alloc(
return _xfs_buf_alloc(target, &map, 1, flags);
}
-struct xfs_buf *xfs_buf_get(struct xfs_buftarg *target, xfs_daddr_t blkno,
- size_t numblks, xfs_buf_flags_t flags);
-struct xfs_buf *xfs_buf_read(struct xfs_buftarg *target, xfs_daddr_t blkno,
- size_t numblks, xfs_buf_flags_t flags);
-void xfs_buf_readahead(struct xfs_buftarg *target, xfs_daddr_t blkno,
- size_t numblks);
+struct xfs_buf *xfs_buf_get_map(struct xfs_buftarg *target,
+ struct xfs_buf_map *map, int nmaps,
+ xfs_buf_flags_t flags);
+struct xfs_buf *xfs_buf_read_map(struct xfs_buftarg *target,
+ struct xfs_buf_map *map, int nmaps,
+ xfs_buf_flags_t flags);
+void xfs_buf_readahead_map(struct xfs_buftarg *target,
+ struct xfs_buf_map *map, int nmaps);
+
+static inline struct xfs_buf *
+xfs_buf_get(
+ struct xfs_buftarg *target,
+ xfs_daddr_t blkno,
+ size_t numblks,
+ xfs_buf_flags_t flags)
+{
+ struct xfs_buf_map map = {
+ .bm_bn = blkno,
+ .bm_len = numblks,
+ };
+ return xfs_buf_get_map(target, &map, 1, flags);
+}
+
+static inline struct xfs_buf *
+xfs_buf_read(
+ struct xfs_buftarg *target,
+ xfs_daddr_t blkno,
+ size_t numblks,
+ xfs_buf_flags_t flags)
+{
+ struct xfs_buf_map map = {
+ .bm_bn = blkno,
+ .bm_len = numblks,
+ };
+ return xfs_buf_read_map(target, &map, 1, flags);
+}
+
+static inline void
+xfs_buf_readahead(
+ struct xfs_buftarg *target,
+ xfs_daddr_t blkno,
+ size_t numblks)
+{
+ struct xfs_buf_map map = {
+ .bm_bn = blkno,
+ .bm_len = numblks,
+ };
+ return xfs_buf_readahead_map(target, &map, 1);
+}
struct xfs_buf *xfs_buf_get_empty(struct xfs_buftarg *target, size_t numblks);
void xfs_buf_set_empty(struct xfs_buf *bp, size_t numblks);
--
1.7.9.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2012-04-24 6:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 6:33 [PATCH 00/10] xfs: discontiguous buffer support a.k.a. die xfs_dabuf die Dave Chinner
2012-04-24 6:33 ` [PATCH 01/10] xfs: add trace points for log forces Dave Chinner
2012-04-30 19:25 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 02/10] xfs: separate buffer indexing from block map Dave Chinner
2012-04-30 19:28 ` Mark Tinguely
2012-04-30 23:24 ` Dave Chinner
2012-05-01 13:16 ` Mark Tinguely
2012-05-02 1:16 ` Dave Chinner
2012-04-24 6:33 ` [PATCH 03/10] xfs: convert internal buffer functions to pass maps Dave Chinner
2012-05-01 15:13 ` Mark Tinguely
2012-04-24 6:33 ` Dave Chinner [this message]
2012-05-01 18:10 ` [PATCH 04/10] xfs: add discontiguous buffer map interface Mark Tinguely
2012-04-24 6:33 ` [PATCH 05/10] xfs: add discontiguous buffer support to transactions Dave Chinner
2012-05-03 19:41 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 06/10] xfs: struct xfs_buf_log_format isn't variable sized Dave Chinner
2012-05-02 13:39 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 07/10] xfs: support discontiguous buffers in the xfs_buf_log_item Dave Chinner
2012-05-03 19:42 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 08/10] xfs: use multiple irec xfs buf support in dabuf Dave Chinner
2012-05-03 19:43 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 09/10] xfs: remove struct xfs_dabuf and infrastructure Dave Chinner
2012-05-04 19:54 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 10/10] xfs: factor buffer reading from xfs_dir2_leaf_getdents Dave Chinner
2012-05-04 12:42 ` Mark Tinguely
2012-05-16 17:40 ` [PATCH 00/10] xfs: discontiguous buffer support a.k.a. die xfs_dabuf die Ben Myers
2012-05-23 9:27 ` Dave Chinner
2012-05-30 14:48 ` Ben Myers
2012-05-30 19:48 ` Ben Myers
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=1335249220-22274-5-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