Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754119AbbLRQON (ORCPT ); Fri, 18 Dec 2015 11:14:13 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:63480 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753882AbbLRQOL convert rfc822-to-8bit (ORCPT ); Fri, 18 Dec 2015 11:14:11 -0500 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Matias =?ISO-8859-1?Q?Bj=F8rling?= , Jens Axboe , Linus Torvalds , Linux Kernel Mailing List Subject: Re: [PATCH] null_blk: use sector_div instead of do_div Date: Fri, 18 Dec 2015 17:13:40 +0100 Message-ID: <5665391.6n2Zq774pT@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <56596064.2070306@bjorling.me> References: <3768541.ja0r6f0Odi@wuerfel> <4449032.oPBtpzlXyB@wuerfel> <56596064.2070306@bjorling.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" X-Provags-ID: V03:K0:cbFWu7NHviMQAgMCO0qQkdYvE7HH0TV/cxCXajkvtdLz2xHG3bE 93MRgwtfWZ+3eylzyfG05DgtBPQ5an/UArFWiCepNZyfOsJbvtnMp99byFb6JouIEzmU47s ZkexHXBkM8dZSUKDOmsXCGD7zFX6iJQb3+xNDtKeOrgsAYPJLIARQ2UEYwAHracLQccNVk0 /7oOTGZo33BYFu8nmhXPQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:foxbRwaTaf8=:0Y4fLcC6E2L+JRD/lauvvd h+/C/8f8NMXLwRgig7xdrsfb17JznAesC/HeEUKE6B6C+DxQZiaDvySRrUTnKvXU7hZerfwdi oIEjSS9oANOafcJ4yvPi/rudU7XpLFoe0/bYmGywcEAUhg5Wa0z+kI+BNki72r66G7goAHPf1 WMefJ3V970NgbTw3TyXsUGRp6JnMVw6HsDeL96RGuBT0RX8yATnCFCypzE1JQbjd1oskrYjSs EEcByL+ljOoUoIuLvLChpT/+Zfby3Rdhl1LMv2krvscnosFULYaxCAW8CZvlgObqp1RWCAqB0 4hkVpOPR8f6rux6OQLTzrA+cfbEa6KdlA4WBb9TAstkPteeke/LvdCBwnloPCSTiV2eu4P4xG 63arbxo9xoAIkC0B9KJgX4CPlB39FBZKEE1vy5cr0HzElqbOlGDc5eJE1hBD05zllFuUw8QIa MBj9/gOYS8yk5tokNO/RKDkaqvU09eTNLvWLajeTNXUMcIn6Oy++iRlIZj6W1QXnTzAhm/D8F VPJ19+6yEztTJTE8zKtpIyUPTvs2GMO8k8p1aC0aEb3gwPssli5b9mlysbWNtCpV9sK19n17A F7CSzjQDb3rb7wyNoTD0C7fGfl/S5eNvFOwartlQBVecCBJV4Z+Bo+OBS50jG89GPGItYI/0a NJNWenEKXHi4bKGXiyR7KucPXl4wTXYB4GFRm40/3NUrk5XY1G52e+sXzq3b5CAQw3atrDm29 D9DKJOGpyFd5Et9k Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1838 Lines: 49 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; > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/