From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Dave Chinner <dchinner@redhat.com>
Subject: [PATCH 10/14] xfs: make xfs_trans_get_buf_map return an error code
Date: Thu, 20 Feb 2020 01:45:34 +0000 (UTC) [thread overview]
Message-ID: <158216313447.603628.14166657759232654808.stgit@magnolia> (raw)
In-Reply-To: <158216306957.603628.16404096061228456718.stgit@magnolia>
From: Darrick J. Wong <darrick.wong@oracle.com>
Source kernel commit: 9676b54e6e28689af1b4247569f14466bdfc5390
Convert xfs_trans_get_buf_map() to return numeric error codes like most
everywhere else in xfs.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
include/xfs_trans.h | 15 ++++++++++-----
libxfs/trans.c | 22 +++++++++++-----------
libxfs/xfs_da_btree.c | 8 ++------
3 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/include/xfs_trans.h b/include/xfs_trans.h
index cff27546..d94617e0 100644
--- a/include/xfs_trans.h
+++ b/include/xfs_trans.h
@@ -105,10 +105,9 @@ void libxfs_trans_log_buf(struct xfs_trans *, struct xfs_buf *,
uint, uint);
bool libxfs_trans_ordered_buf(xfs_trans_t *, struct xfs_buf *);
-struct xfs_buf *libxfs_trans_get_buf_map(struct xfs_trans *tp,
- struct xfs_buftarg *btp,
- struct xfs_buf_map *map, int nmaps,
- xfs_buf_flags_t flags);
+int libxfs_trans_get_buf_map(struct xfs_trans *tp, struct xfs_buftarg *btp,
+ struct xfs_buf_map *map, int nmaps, xfs_buf_flags_t flags,
+ struct xfs_buf **bpp);
int libxfs_trans_read_buf_map(struct xfs_mount *mp, struct xfs_trans *tp,
struct xfs_buftarg *btp,
@@ -123,8 +122,14 @@ libxfs_trans_get_buf(
int numblks,
uint flags)
{
+ struct xfs_buf *bp;
+ int error;
DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
- return libxfs_trans_get_buf_map(tp, btp, &map, 1, flags);
+
+ error = libxfs_trans_get_buf_map(tp, btp, &map, 1, flags, &bp);
+ if (error)
+ return NULL;
+ return bp;
}
static inline int
diff --git a/libxfs/trans.c b/libxfs/trans.c
index b833e369..d200038b 100644
--- a/libxfs/trans.c
+++ b/libxfs/trans.c
@@ -415,24 +415,22 @@ libxfs_trans_bhold_release(
* If the transaction pointer is NULL, make this just a normal
* get_buf() call.
*/
-struct xfs_buf *
+int
libxfs_trans_get_buf_map(
struct xfs_trans *tp,
struct xfs_buftarg *target,
struct xfs_buf_map *map,
int nmaps,
- xfs_buf_flags_t flags)
+ xfs_buf_flags_t flags,
+ struct xfs_buf **bpp)
{
struct xfs_buf *bp;
struct xfs_buf_log_item *bip;
int error;
- if (!tp) {
- error = libxfs_buf_get_map(target, map, nmaps, 0, &bp);
- if (error)
- return NULL;
- return bp;
- }
+ *bpp = NULL;
+ if (!tp)
+ return libxfs_buf_get_map(target, map, nmaps, 0, bpp);
/*
* If we find the buffer in the cache with this transaction
@@ -447,18 +445,20 @@ libxfs_trans_get_buf_map(
ASSERT(bip != NULL);
bip->bli_recur++;
trace_xfs_trans_get_buf_recur(bip);
- return bp;
+ *bpp = bp;
+ return 0;
}
error = libxfs_buf_get_map(target, map, nmaps, 0, &bp);
if (error)
- return NULL;
+ return error;
ASSERT(!bp->b_error);
_libxfs_trans_bjoin(tp, bp, 1);
trace_xfs_trans_get_buf(bp->b_log_item);
- return bp;
+ *bpp = bp;
+ return 0;
}
xfs_buf_t *
diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c
index 5102c6e0..3f40e99e 100644
--- a/libxfs/xfs_da_btree.c
+++ b/libxfs/xfs_da_btree.c
@@ -2588,13 +2588,9 @@ xfs_da_get_buf(
if (error || nmap == 0)
goto out_free;
- bp = xfs_trans_get_buf_map(tp, mp->m_ddev_targp, mapp, nmap, 0);
- error = bp ? bp->b_error : -EIO;
- if (error) {
- if (bp)
- xfs_trans_brelse(tp, bp);
+ error = xfs_trans_get_buf_map(tp, mp->m_ddev_targp, mapp, nmap, 0, &bp);
+ if (error)
goto out_free;
- }
*bpp = bp;
next prev parent reply other threads:[~2020-02-20 1:46 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 1:44 [PATCH 00/14] xfsprogs: make buffer functions return error codes Darrick J. Wong
2020-02-20 1:44 ` [PATCH 01/14] libxfs: make __cache_lookup return an error code Darrick J. Wong
2020-02-21 14:55 ` Christoph Hellwig
2020-02-20 1:44 ` [PATCH 02/14] libxfs: make libxfs_getbuf_flags " Darrick J. Wong
2020-02-21 14:56 ` Christoph Hellwig
2020-02-20 1:44 ` [PATCH 03/14] libxfs: make libxfs_buf_get_map " Darrick J. Wong
2020-02-21 14:57 ` Christoph Hellwig
2020-02-21 16:01 ` Darrick J. Wong
2020-02-20 1:44 ` [PATCH 04/14] libxfs: refactor libxfs_readbuf out of existence Darrick J. Wong
2020-02-21 15:00 ` Christoph Hellwig
2020-02-21 22:13 ` Darrick J. Wong
2020-02-20 1:45 ` [PATCH 05/14] libxfs: make libxfs_buf_read_map return an error code Darrick J. Wong
2020-02-21 15:03 ` Christoph Hellwig
2020-02-21 16:15 ` Darrick J. Wong
2020-02-21 16:28 ` Christoph Hellwig
2020-02-20 1:45 ` [PATCH 06/14] xfs: make xfs_buf_read_map " Darrick J. Wong
2020-02-20 1:45 ` [PATCH 07/14] xfs: make xfs_buf_get " Darrick J. Wong
2020-02-20 1:45 ` [PATCH 08/14] xfs: make xfs_buf_get_uncached " Darrick J. Wong
2020-02-20 1:45 ` [PATCH 09/14] xfs: make xfs_buf_read " Darrick J. Wong
2020-02-20 1:45 ` Darrick J. Wong [this message]
2020-02-20 1:45 ` [PATCH 11/14] xfs: make xfs_trans_get_buf " Darrick J. Wong
2020-02-20 1:45 ` [PATCH 12/14] xfs: remove the xfs_btree_get_buf[ls] functions Darrick J. Wong
2020-02-20 1:45 ` [PATCH 13/14] xfs: make xfs_*read_agf return EAGAIN to ALLOC_FLAG_TRYLOCK callers Darrick J. Wong
2020-02-20 1:45 ` [PATCH 14/14] xfs: remove unnecessary null pointer checks from _read_agf callers Darrick J. Wong
2020-02-20 1:53 ` [PATCH 00/14] xfsprogs: make buffer functions return error codes Darrick J. Wong
2020-02-25 0:14 [PATCH v2 " Darrick J. Wong
2020-02-25 0:15 ` [PATCH 10/14] xfs: make xfs_trans_get_buf_map return an error code Darrick J. Wong
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=158216313447.603628.14166657759232654808.stgit@magnolia \
--to=darrick.wong@oracle.com \
--cc=dchinner@redhat.com \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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;
as well as URLs for NNTP newsgroup(s).