From: Jens Axboe <axboe@kernel.dk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christoph Hellwig <hch@infradead.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [GIT PULL] bdev size cleanups
Date: Tue, 2 Nov 2021 09:28:08 -0600 [thread overview]
Message-ID: <74554d1d-7929-44d0-dadd-78df31bed0a2@kernel.dk> (raw)
In-Reply-To: <CAHk-=wh6dwyg9XMxiBB9or2oofXea7VY_hMjm4-0_9YU8o+LZQ@mail.gmail.com>
On 11/1/21 5:50 PM, Linus Torvalds wrote:
> On Mon, Nov 1, 2021 at 4:20 PM Jens Axboe <axboe@kernel.dk> wrote:
>>
>> Yes, probably safer just to make bdev_nr_bytes() return sector_t as
>> well, even if loff_t isn't strictly wrong.
>
> Well, that would actually change the sign of some of the existing
> comparisons. Possibly changing their meaning entirely..
>
> So having 'loff_t' being signed may be an odd choice for a byte size,
> but it is what it is. At least the current set of cleanups seemed to
> keep the type logic the same when it changed i_size_read() to be
> bdev_nr_bytes() instead.
>
> Changing it to 'sector_t' not only doesn't make conceptual sense when
> it's a byte count, it might also be dangerous.
>
> So my reaction was really that it wasn't obvious that bdev_nr_bytes()
> did the shift in the right type.. It does happen to do that, but
> historically sector_t was the smaller type.
OK, I misunderstood your original email, as per Christoph's email as
well. May be worth adding loff_t cast, if for nothing else just to have
it stick out to the next person touching it.
--
Jens Axboe
next prev parent reply other threads:[~2021-11-02 15:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-31 19:41 [GIT PULL] bdev size cleanups Jens Axboe
2021-11-01 17:02 ` Linus Torvalds
2021-11-01 23:19 ` Jens Axboe
2021-11-01 23:50 ` Linus Torvalds
2021-11-02 15:28 ` Jens Axboe [this message]
2021-11-02 6:10 ` Christoph Hellwig
2021-11-01 17:28 ` pr-tracker-bot
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=74554d1d-7929-44d0-dadd-78df31bed0a2@kernel.dk \
--to=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.