public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@gmail.com>
To: Tom Yan <tom.ty89@gmail.com>, linux-block@vger.kernel.org
Cc: linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: [RFC] block: avoid the unnecessary blk_bio_discard_split()
Date: Sun, 6 Dec 2020 13:16:04 +0300	[thread overview]
Message-ID: <55e0b8be-a16b-9895-fde5-b325773ae0e7@gmail.com> (raw)
In-Reply-To: <20201206061537.3870-1-tom.ty89@gmail.com>

Hello!

On 06.12.2020 9:15, Tom Yan wrote:

> It doesn't seem necessary to have the redundant layer of splitting.
> The request size will even be more consistent / aligned to the cap.
> 
> Signed-off-by: Tom Yan <tom.ty89@gmail.com>
> ---
>   block/blk-lib.c   | 5 ++++-
>   block/blk-merge.c | 2 +-
>   block/blk.h       | 8 ++++++--
>   3 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index e90614fd8d6a..f606184a9050 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -85,9 +85,12 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
>   		 *   is split in device drive, the split ones are very probably
>   		 *   to be aligned to discard_granularity of the device's queue.
>   		 */
> -		if (granularity_aligned_lba == sector_mapped)
> +		if (granularity_aligned_lba == sector_mapped) {
>   			req_sects = min_t(sector_t, nr_sects,
>   					  bio_aligned_discard_max_sectors(q));
> +			if (!req_sects)
> +				return -EOPNOTSUPP;
> +		}
>   		else

    Needs to be } else { according to the CodingStyle doc...

>   			req_sects = min_t(sector_t, nr_sects,
>   					  granularity_aligned_lba - sector_mapped);
[...]

MBR, Sergei

  reply	other threads:[~2020-12-06 10:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06  6:15 [RFC] block: avoid the unnecessary blk_bio_discard_split() Tom Yan
2020-12-06 10:16 ` Sergei Shtylyov [this message]
2020-12-10 11:37   ` [RFC v2] " Tom Yan
2020-12-11 16:13     ` [RFC v3] " Tom Yan
2020-12-12  2:01       ` 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=55e0b8be-a16b-9895-fde5-b325773ae0e7@gmail.com \
    --to=sergei.shtylyov@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tom.ty89@gmail.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