All of lore.kernel.org
 help / color / mirror / Atom feed
From: Feng Li <lifeng1519@gmail.com>
To: Li Feng <fengli@smartx.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	"open list:BLOCK LAYER" <linux-block@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] blk: avoid divide-by-zero with zero granularity
Date: Tue, 12 Jan 2021 23:34:06 +0800	[thread overview]
Message-ID: <CAEK8JBD68oTcuV+Cf-S1Vv-n6nyr5UM_zWA5iJFHP=UvQ14AZg@mail.gmail.com> (raw)
In-Reply-To: <20210112152951.154024-1-fengli@smartx.com>

I'm sorry, ignore this one.

Li Feng <fengli@smartx.com> 于2021年1月12日周二 下午11:30写道:
>
> If the physical_block_size and io_min is less than a sector, the
> 'granularity >> SECTOR_SHIFT' will be zero.
>
> Signed-off-by: Li Feng <fengli@smartx.com>
> ---
>  include/linux/blkdev.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index f94ee3089e01..4d029e95adb4 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1485,6 +1485,10 @@ static inline int queue_alignment_offset(const struct request_queue *q)
>  static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector)
>  {
>         unsigned int granularity = max(lim->physical_block_size, lim->io_min);
> +       granularity = granularity >> SECTOR_SHIFT;
> +       if (!granularity)
> +               return 0;
> +
>         unsigned int alignment = sector_div(sector, granularity >> SECTOR_SHIFT)
>                 << SECTOR_SHIFT;
>
> --
> 2.29.2
>

  reply	other threads:[~2021-01-12 15:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 15:29 [PATCH] blk: avoid divide-by-zero with zero granularity Li Feng
2021-01-12 15:34 ` Feng Li [this message]
2021-01-12 15:55 ` [PATCH v2] " Li Feng
2021-01-12 17:10   ` Martin K. Petersen
2021-01-12 17:27     ` Feng Li
2021-01-12 17:36       ` Johannes Thumshirn
2021-01-12 17:46         ` Martin K. Petersen
2021-01-13  2:42           ` Li Feng
2021-01-12 18:42 ` [PATCH] " kernel test robot
2021-01-12 18:42   ` kernel test robot
2021-01-12 21:49 ` kernel test robot
2021-01-12 21:49   ` kernel test robot
2021-01-12 22:57 ` kernel test robot
2021-01-12 22:57   ` kernel test robot

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='CAEK8JBD68oTcuV+Cf-S1Vv-n6nyr5UM_zWA5iJFHP=UvQ14AZg@mail.gmail.com' \
    --to=lifeng1519@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=fengli@smartx.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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.