From: Christoph Hellwig <hch@lst.de>
To: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
Cc: linux-block@vger.kernel.org, dm-devel@lists.linux.dev,
linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-xfs@vger.kernel.org, axboe@kernel.dk, agk@redhat.com,
snitzer@kernel.org, mpatocka@redhat.com, song@kernel.org,
yukuai3@huawei.com, hch@lst.de, sagi@grimberg.me, kch@nvidia.com,
jaegeuk@kernel.org, chao@kernel.org, cem@kernel.org
Subject: Re: [RFC PATCH] block: change __blkdev_issue_discard() return type to void
Date: Tue, 18 Nov 2025 09:04:27 +0100 [thread overview]
Message-ID: <20251118080427.GA26299@lst.de> (raw)
In-Reply-To: <20251118074243.636812-1-ckulkarnilinux@gmail.com>
On Mon, Nov 17, 2025 at 11:42:43PM -0800, Chaitanya Kulkarni wrote:
> Due to involvement of all the subsystem making it as an RFC, ideally
> it shuoldn't be an RFC.
I think best would be a series that drops error checking first,
and then changes the return type. That way we can maybe get all
the callers fixed up in this merge window and then drop the return
value after -rc1.
> gfp_mask)))
> *biop = bio_chain_and_submit(*biop, bio);
> - return 0;
> }
> EXPORT_SYMBOL(__blkdev_issue_discard);
>
> @@ -90,8 +89,8 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
> int ret;
>
> blk_start_plug(&plug);
> - ret = __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, &bio);
> - if (!ret && bio) {
> + __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, &bio);
ret now needs to be initialized to 0 above.
> index 8d246b8ca604..f26010c46c33 100644
> --- a/drivers/nvme/target/io-cmd-bdev.c
> +++ b/drivers/nvme/target/io-cmd-bdev.c
> @@ -366,16 +366,11 @@ static u16 nvmet_bdev_discard_range(struct nvmet_req *req,
> struct nvme_dsm_range *range, struct bio **bio)
> {
> struct nvmet_ns *ns = req->ns;
> - int ret;
>
> - ret = __blkdev_issue_discard(ns->bdev,
> + __blkdev_issue_discard(ns->bdev,
> nvmet_lba_to_sect(ns, range->slba),
> le32_to_cpu(range->nlb) << (ns->blksize_shift - 9),
> GFP_KERNEL, bio);
> - if (ret && ret != -EOPNOTSUPP) {
> - req->error_slba = le64_to_cpu(range->slba);
> - return errno_to_nvme_status(req, ret);
> - }
> return NVME_SC_SUCCESS;
nvmet_bdev_discard_range can return void now.
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index b45eace879d7..e6078176f733 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1346,7 +1346,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
> if (time_to_inject(sbi, FAULT_DISCARD)) {
> err = -EIO;
> } else {
> - err = __blkdev_issue_discard(bdev,
> + __blkdev_issue_discard(bdev,
> SECTOR_FROM_BLOCK(start),
> SECTOR_FROM_BLOCK(len),
> GFP_NOFS, &bio);
Please fold the following 'if (err)' block directly into the injection
one, and either initialize err to 0, or use a direct return from that
block to skip the last branch in the function checking err.
> blk_finish_plug(&plug);
>
> - return error;
> + return 0;
Please drop the error return for xfs_discard_extents entirely.
next prev parent reply other threads:[~2025-11-18 8:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 7:42 [RFC PATCH] block: change __blkdev_issue_discard() return type to void Chaitanya Kulkarni
2025-11-18 8:04 ` Christoph Hellwig [this message]
2025-11-19 1:48 ` 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=20251118080427.GA26299@lst.de \
--to=hch@lst.de \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=cem@kernel.org \
--cc=chao@kernel.org \
--cc=ckulkarnilinux@gmail.com \
--cc=dm-devel@lists.linux.dev \
--cc=jaegeuk@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-raid@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=sagi@grimberg.me \
--cc=snitzer@kernel.org \
--cc=song@kernel.org \
--cc=yukuai3@huawei.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