target-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Matthew Wilcox <willy@infradead.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"target-devel@vger.kernel.org" <target-devel@vger.kernel.org>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"mb@lightnvm.io" <mb@lightnvm.io>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"clm@fb.com" <clm@fb.com>,
	"josef@toxicpanda.com" <josef@toxicpanda.com>,
	"dsterba@suse.com" <dsterba@suse.com>,
	Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	"ming.lei@redhat.com" <ming.lei@redhat.com>,
	"osandov@fb.com" <osandov@fb.com>,
	"jefflexu@linux.alibaba.com" <jefflexu@linux.alibaba.com>
Subject: Re: [RFC PATCH 0/8] block: fix bio_add_XXX_page() return type
Date: Wed, 26 May 2021 02:55:57 +0000	[thread overview]
Message-ID: <BYAPR04MB49650508F2C5A4EA3B576D5286249@BYAPR04MB4965.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20210524073527.GA24302@lst.de

Christoph,

On 5/24/21 00:35, Christoph Hellwig wrote:
> On Fri, May 21, 2021 at 12:30:45PM +0100, Matthew Wilcox wrote:
>> On Wed, May 19, 2021 at 11:22:47PM -0700, Chaitanya Kulkarni wrote:
>>> The helper functions bio_add_XXX_page() returns the length which is
>>> unsigned int but the return type of those functions is defined
>>> as int instead of unsigned int.
>> I've been thinking about this for a few weeks as part of the folio
>> patches:
>>
>> https://lore.kernel.org/linux-fsdevel/20210505150628.111735-72-willy@infradead.org/
>>
>>  - len and off are measured in bytes
>>  - neither are permitted to be negative
>>  - for efficiency we only permit them to be up to 4GB
>>
>> I therefore believe the correct type for these parameters to be size_t,
>> and we should range-check them if they're too large.  they should
>> actually always fit within the page that they're associated with, but
>> people do allocate non-compound pages and i'm not trying to break that
>> today.
>>
>> using size_t makes it clear that these are byte counts, not (eg) sector
>> counts.  i do think it's good to make the return value unsigned so we
>> don't have people expecting a negative errno on failure.
> I think the right type is bool.  We always return either 0 or the full
> length we tried to add.  Instead of optimizing for a partial add (which
> only makes sense for bio_add_hw_page anyway), I'd rather make the
> interface as simple as possible.
>

Is above comment is on this series or on the API present in the folio
patches [1] ?

Since if we change the return type to bool for the functions in
question [2] in this series we also need to modify the callers, I'm not sure
that is worth it though.

Please confirm.

[1]
https://lore.kernel.org/linux-fsdevel/20210505150628.111735-72-willy@infradead.org/


[2]
bio_add_hw_page()
bio_add_pc_page()
bio_add_zone_append_page()
bio_add page()



  parent reply	other threads:[~2021-05-26  2:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20  6:22 [RFC PATCH 0/8] block: fix bio_add_XXX_page() return type Chaitanya Kulkarni
2021-05-20  6:22 ` [RFC PATCH 1/8] block: fix return type of bio_add_hw_page() Chaitanya Kulkarni
2021-05-20  6:22 ` [RFC PATCH 2/8] block: fix return type of bio_add_pc_page() Chaitanya Kulkarni
2021-05-20  6:22 ` [RFC PATCH 3/8] block: fix return type of bio_add_zone_append_page Chaitanya Kulkarni
2021-05-20  6:22 ` [RFC PATCH 4/8] block: fix return type of bio_add_page() Chaitanya Kulkarni
2021-05-20  6:22 ` [RFC PATCH 5/8] lightnvm: fix variable type pblk-core Chaitanya Kulkarni
2021-05-20  6:22 ` [RFC PATCH 6/8] pscsi: fix variable type pscsi_map_sg Chaitanya Kulkarni
2021-05-20  6:22 ` [RFC PATCH 7/8] btrfs: fix variable type in btrfs_bio_add_page Chaitanya Kulkarni
2021-05-20  6:22 ` [RFC PATCH 8/8] block: fix variable type for zero pages Chaitanya Kulkarni
2021-05-21 10:25 ` [RFC PATCH 0/8] block: fix bio_add_XXX_page() return type Johannes Thumshirn
2021-05-21 21:37   ` Chaitanya Kulkarni
2021-05-21 22:37     ` Omar Sandoval
2021-05-21 23:25       ` Chaitanya Kulkarni
2021-05-21 11:30 ` Matthew Wilcox
2021-05-21 21:51   ` Chaitanya Kulkarni
2021-05-24  7:35   ` Christoph Hellwig
2021-05-24 13:29     ` Matthew Wilcox
2021-05-26  2:55     ` Chaitanya Kulkarni [this message]
2021-05-27 11:43       ` Christoph Hellwig
2021-05-27 17:43         ` Chaitanya Kulkarni

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=BYAPR04MB49650508F2C5A4EA3B576D5286249@BYAPR04MB4965.namprd04.prod.outlook.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=jefflexu@linux.alibaba.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mb@lightnvm.io \
    --cc=ming.lei@redhat.com \
    --cc=osandov@fb.com \
    --cc=target-devel@vger.kernel.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).