From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>, xfs@oss.sgi.com
Subject: Re: [PATCH 2/3] libxfs: remove map from libxfs_readbufr_map
Date: Thu, 23 Jan 2014 12:15:10 -0500 [thread overview]
Message-ID: <52E14E1E.8040605@redhat.com> (raw)
In-Reply-To: <1390375033-10483-3-git-send-email-david@fromorbit.com>
On 01/22/2014 02:17 AM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> The map passed in to libxfs_readbufr_map is used to check the buffer
> matches the map. However, the repair readahead code has no map it
> can use to validate the buffer it set up previously, so just get rid
> of the map being passed in because it serves no useful purpose.
>
The code looks fine, effectively just removing some assert code, but I'm
not following the reasoning. I'm probably missing some context. Is the
justification that no callers of libxfs_readbufr_map() will actually
pass a map, or that the checking is not useful (redundant)?
Brian
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> db/io.c | 4 +---
> include/libxfs.h | 3 +--
> libxfs/rdwr.c | 12 ++----------
> 3 files changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/db/io.c b/db/io.c
> index 123214d..d29816c 100644
> --- a/db/io.c
> +++ b/db/io.c
> @@ -449,9 +449,7 @@ write_cur_bbs(void)
>
>
> /* re-read buffer from disk */
> - ret = libxfs_readbufr_map(mp->m_ddev_targp, iocur_top->bp,
> - iocur_top->bbmap->b, iocur_top->bbmap->nmaps,
> - 0);
> + ret = libxfs_readbufr_map(mp->m_ddev_targp, iocur_top->bp, 0);
> if (ret != 0)
> dbprintf(_("read error: %s\n"), strerror(ret));
> }
> diff --git a/include/libxfs.h b/include/libxfs.h
> index 2872410..bb0369f 100644
> --- a/include/libxfs.h
> +++ b/include/libxfs.h
> @@ -448,8 +448,7 @@ extern void libxfs_putbufr(xfs_buf_t *);
> extern int libxfs_writebuf_int(xfs_buf_t *, int);
> extern int libxfs_writebufr(struct xfs_buf *);
> extern int libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t *, int, int);
> -extern int libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *,
> - struct xfs_buf_map *, int, int);
> +extern int libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *, int);
>
> extern int libxfs_bhash_size;
>
> diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
> index bf92788..ac7739f 100644
> --- a/libxfs/rdwr.c
> +++ b/libxfs/rdwr.c
> @@ -727,27 +727,19 @@ libxfs_readbuf(struct xfs_buftarg *btp, xfs_daddr_t blkno, int len, int flags,
> }
>
> int
> -libxfs_readbufr_map(struct xfs_buftarg *btp, struct xfs_buf *bp,
> - struct xfs_buf_map *map, int nmaps, int flags)
> +libxfs_readbufr_map(struct xfs_buftarg *btp, struct xfs_buf *bp, int flags)
> {
> int fd = libxfs_device_to_fd(btp->dev);
> int error = 0;
> char *buf;
> int i;
>
> - ASSERT(BBTOB(len) <= bp->b_bcount);
> -
> - ASSERT(bp->b_nmaps == nmaps);
> -
> fd = libxfs_device_to_fd(btp->dev);
> buf = bp->b_addr;
> for (i = 0; i < bp->b_nmaps; i++) {
> off64_t offset = LIBXFS_BBTOOFF64(bp->b_map[i].bm_bn);
> int len = BBTOB(bp->b_map[i].bm_len);
>
> - ASSERT(bp->b_map[i].bm_bn == map[i].bm_bn);
> - ASSERT(bp->b_map[i].bm_len == map[i].bm_len);
> -
> error = __read_buf(fd, buf, len, offset, flags);
> if (error) {
> bp->b_error = error;
> @@ -787,7 +779,7 @@ libxfs_readbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps,
> if ((bp->b_flags & (LIBXFS_B_UPTODATE|LIBXFS_B_DIRTY)))
> return bp;
>
> - error = libxfs_readbufr_map(btp, bp, map, nmaps, flags);
> + error = libxfs_readbufr_map(btp, bp, flags);
> if (!error) {
> bp->b_flags |= LIBXFS_B_UPTODATE;
> if (bp->b_ops)
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-01-23 17:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 7:17 [PATCH 0/3] xfs_repair: fix discontiguous directory block Dave Chinner
2014-01-22 7:17 ` [PATCH 1/3] libxfs: add a flags field to libxfs_getbuf_map Dave Chinner
2014-01-23 17:14 ` Brian Foster
2014-01-22 7:17 ` [PATCH 2/3] libxfs: remove map from libxfs_readbufr_map Dave Chinner
2014-01-23 17:15 ` Brian Foster [this message]
2014-01-23 21:27 ` Dave Chinner
2014-01-22 7:17 ` [PATCH 3/3] repair: fix discontiguous directory block support Dave Chinner
2014-01-23 17:15 ` Brian Foster
2014-01-23 21:41 ` Dave Chinner
-- strict thread matches above, loose matches on Subject: below --
2014-01-23 23:21 [PATCH 0/3 V2] repair: " Dave Chinner
2014-01-23 23:21 ` [PATCH 2/3] libxfs: remove map from libxfs_readbufr_map Dave Chinner
2014-01-24 14:39 ` Brian Foster
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=52E14E1E.8040605@redhat.com \
--to=bfoster@redhat.com \
--cc=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;
as well as URLs for NNTP newsgroup(s).