From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] null_blk: use sector_div instead of do_div
Date: Fri, 18 Dec 2015 17:13:40 +0100 [thread overview]
Message-ID: <5665391.6n2Zq774pT@wuerfel> (raw)
In-Reply-To: <56596064.2070306@bjorling.me>
On Saturday 28 November 2015 09:05:56 Matias Bj?rling wrote:
>
> I had my head around the original code and kept references to the device
> layout I had in mind. 256 being number of pages in a block, and the 2^16
> being number of blocks in a lun and wanted to communicate that part..
> which led to producing silly code in the mean time.
>
> Similarly, the bs is always fixed to 4k for lightnvm, until other bs
> sizes are supported. We could optimize it out, I left it in for the same
> reasons.
I still see the build warning in linux-next, can you merge your patch?
Arnd
> diff --git i/drivers/block/null_blk.c w/drivers/block/null_blk.c
> index 5c8ba54..97c02fe 100644
> --- i/drivers/block/null_blk.c
> +++ w/drivers/block/null_blk.c
> @@ -510,17 +510,17 @@ static int null_lnvm_id(struct request_queue *q,
> struct nvm_id *id)
> id->ppaf.ch_offset = 56;
> id->ppaf.ch_len = 8;
>
> - do_div(size, bs); /* convert size to pages */
> - do_div(size, 256); /* concert size to pgs pr blk */
> + sector_div(size, bs); /* convert size to pages */
> + size >>= 8; /* convert size to pgs pr blk */
> grp = &id->groups[0];
> grp->mtype = 0;
> grp->fmtype = 0;
> grp->num_ch = 1;
> grp->num_pg = 256;
> blksize = size;
> - do_div(size, (1 << 16));
> + size >>= 16; /* convert size to num luns */
> grp->num_lun = size + 1;
> - do_div(blksize, grp->num_lun);
> + sector_div(blksize, grp->num_lun);
> grp->num_blk = blksize;
> grp->num_pln = 1;
>
>
next prev parent reply other threads:[~2015-12-18 16:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 13:49 [PATCH] null_blk: use sector_div instead of do_div Arnd Bergmann
2015-11-27 18:07 ` Linus Torvalds
2015-11-27 21:31 ` Arnd Bergmann
2015-11-28 8:05 ` Matias Bjørling
2015-12-18 16:13 ` Arnd Bergmann [this message]
2016-01-13 21:46 ` Arnd Bergmann
2015-11-30 21:49 ` Jens Axboe
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=5665391.6n2Zq774pT@wuerfel \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).