public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: Do not call sector_div() with a 64-bit divisor
Date: Mon, 04 Nov 2013 15:29:43 -0700	[thread overview]
Message-ID: <52781FD7.9050507@kernel.dk> (raw)
In-Reply-To: <1383570006-4605-1-git-send-email-geert@linux-m68k.org>

On 11/04/2013 06:00 AM, Geert Uytterhoeven wrote:
> do_div() (called by sector_div() if CONFIG_LBDAF=y) is meant for divisions
> of 64-bit number by 32-bit numbers.  Passing 64-bit divisor types caused
> issues in the past on 32-bit platforms, cfr. commit
> ea077b1b96e073eac5c3c5590529e964767fc5f7 ("m68k: Truncate base in
> do_div()").
> 
> As queue_limits.max_discard_sectors and .discard_granularity are unsigned
> int, max_discard_sectors and granularity should be unsigned int.
> As bdev_discard_alignment() returns int, alignment should be int.
> Now 2 calls to sector_div() can be replaced by 32-bit arithmetic:
>   - The 64-bit modulo operation can become a 32-bit modulo operation,
>   - The 64-bit division and multiplication can be replaced by a 32-bit
>     modulo operation and a subtraction.

Thanks Geert, applied.

-- 
Jens Axboe


      reply	other threads:[~2013-11-04 22:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 13:00 [PATCH] block: Do not call sector_div() with a 64-bit divisor Geert Uytterhoeven
2013-11-04 22:29 ` Jens Axboe [this message]

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=52781FD7.9050507@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=akpm@linux-foundation.org \
    --cc=geert@linux-m68k.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox