From: Arnd Bergmann <arnd@arndb.de>
To: Mike Snitzer <snitzer@redhat.com>
Cc: dm-devel@redhat.com, Alasdair Kergon <agk@redhat.com>,
Joe Thornber <ejt@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] dm: era: use do_div for 64-bit division
Date: Tue, 11 Mar 2014 09:31:33 +0100 [thread overview]
Message-ID: <3014967.i7OXqBNQ5E@wuerfel> (raw)
Commit 983043be0c1de "dm era: support non power-of-2 blocksize"
introduced the use of sector_div to divide a variable of type
dm_block_t by an integer. This fails on 32-bit machines when
CONFIG_LBDAF is not set, because that assumes that the first
argument is a 32-bit number.
To allow building this driver in all configurations, we either
have to cast the dm_block_t to sector_t or use do_div(), which
always takes a 64-bit argument. This patch uses the second
approach in order to cope with theoretical configurations where
dm_block_t contains a number that does not fit into sector_t.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Joe Thornber <ejt@redhat.com>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
---
This currently only occurs in linux-next. Please apply.
diff --git a/drivers/md/dm-era-target.c b/drivers/md/dm-era-target.c
index d7bd7b3..3383423 100644
--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -1123,7 +1123,7 @@ static dm_block_t get_block(struct era *era, struct bio *bio)
dm_block_t block_nr = bio->bi_iter.bi_sector;
if (!block_size_is_power_of_two(era))
- (void) sector_div(block_nr, era->sectors_per_block);
+ (void) do_div(block_nr, era->sectors_per_block);
else
block_nr >>= era->sectors_per_block_shift;
next reply other threads:[~2014-03-11 8:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 8:31 Arnd Bergmann [this message]
2014-03-11 12:59 ` Mike Snitzer
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=3014967.i7OXqBNQ5E@wuerfel \
--to=arnd@arndb.de \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=ejt@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@redhat.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
all inboxes | Powered by JetHome®