From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: Linux-MM <linux-mm@kvack.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
linux-block <linux-block@vger.kernel.org>,
Matthew Wilcox <willy@infradead.org>, Chris Mason <clm@fb.com>,
Dave Chinner <david@fromorbit.com>
Subject: Re: [PATCH 4/6] iomap: add struct iomap_ctx
Date: Tue, 17 Dec 2019 11:39:41 -0800 [thread overview]
Message-ID: <CAHk-=wgcPAfOSigMf0xwaGfVjw413XN3UPATwYWHrss+QuivhQ@mail.gmail.com> (raw)
In-Reply-To: <20191217143948.26380-5-axboe@kernel.dk>
On Tue, Dec 17, 2019 at 6:40 AM Jens Axboe <axboe@kernel.dk> wrote:
>
> We pass a lot of arguments to iomap_apply(), and subsequently to the
> actors that it calls. In preparation for adding one more argument,
> switch them to using a struct iomap_ctx instead. The actor gets a const
> version of that, they are not supposed to change anything in it.
Looks generally like what I expected, but when looking at the patch I
notice that the type of 'len' is crazy and wrong.
It was wrong before too, though:
> -dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
'loff_t length' is not right.
> + loff_t pos = data->pos;
> + loff_t length = pos + data->len;
And WTH is that? "pos + data->len" is not "length", that's end. And this:
> loff_t end = pos + length, done = 0;
What? Now 'end' is 'pos+length', which is 'pos+pos+data->len'.
WHAA?
> @@ -1197,22 +1200,26 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
> {
> + loff_t ret = 0, done = 0;
More insanity. "ret" shouldn't be loff_t.
dax_iomap_rw() returns a ssize_t.
> + loff_t count = data->len;
More of this crazy things.
> iomap_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero,
This was wrong before.
> +struct iomap_ctx {
> + struct inode *inode;
> + loff_t pos;
> + loff_t len;
> + void *priv;
> + unsigned flags;
> +};
Please make 'len' be 'size_t' or something.
If you're on a 32-bit architecture, you shouldn't be writing more than
4GB in a go anyway.
Is there some reason for this horrible case of "let's allow 64-bit sizes?"
Because even if there is, it shouldn't be "loff_t". That's an
_offset_. Not a length.
Linus
next prev parent reply other threads:[~2019-12-17 19:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 14:39 [PATCHSET v5 0/6] Support for RWF_UNCACHED Jens Axboe
2019-12-17 14:39 ` [PATCH 1/6] fs: add read support " Jens Axboe
2019-12-17 15:16 ` Guoqing Jiang
2019-12-17 16:42 ` Jens Axboe
2019-12-17 15:57 ` Matthew Wilcox
2019-12-17 16:41 ` Jens Axboe
2019-12-18 3:17 ` Dave Chinner
2019-12-17 14:39 ` [PATCH 2/6] mm: make generic_perform_write() take a struct kiocb Jens Axboe
2019-12-17 14:39 ` [PATCH 3/6] mm: make buffered writes work with RWF_UNCACHED Jens Axboe
2019-12-17 14:39 ` [PATCH 4/6] iomap: add struct iomap_ctx Jens Axboe
2019-12-17 19:39 ` Linus Torvalds [this message]
2019-12-17 20:26 ` Linus Torvalds
2019-12-18 0:15 ` Jens Axboe
2019-12-18 1:25 ` Darrick J. Wong
2019-12-17 14:39 ` [PATCH 5/6] iomap: support RWF_UNCACHED for buffered writes Jens Axboe
2019-12-18 1:52 ` Darrick J. Wong
2019-12-18 3:18 ` Jens Axboe
2019-12-18 4:15 ` Darrick J. Wong
2019-12-17 14:39 ` [PATCH 6/6] xfs: don't do delayed allocations for uncached " Jens Axboe
2019-12-18 1:57 ` 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='CAHk-=wgcPAfOSigMf0xwaGfVjw413XN3UPATwYWHrss+QuivhQ@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=clm@fb.com \
--cc=david@fromorbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/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).