Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752586AbbBXIau (ORCPT ); Tue, 24 Feb 2015 03:30:50 -0500 Received: from arrakis.dune.hu ([78.24.191.176]:54078 "EHLO arrakis.dune.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751580AbbBXIat (ORCPT ); Tue, 24 Feb 2015 03:30:49 -0500 Message-ID: <54EC369D.7090108@openwrt.org> Date: Tue, 24 Feb 2015 21:30:21 +1300 From: Felix Fietkau User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Brian Norris CC: Rodrigo Freire , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, =?windows-1252?Q?J=F6rn_Engel?= , dwmw2@infradead.org, Herton Krzesinski Subject: Re: [PATCH v3 3/3] mtd: block2mtd: Removes PAGE_MASK as a index to partition size References: <1444809468.34812041.1410206680931.JavaMail.zimbra@redhat.com> <20140909170231.GA14429@logfs.org> <1807144344.40128259.1410985683342.JavaMail.zimbra@redhat.com> <20141105202303.GN23619@ld-irv-0074> <2086372266.7454667.1415535533979.JavaMail.zimbra@redhat.com> <1874445287.7454806.1415535792984.JavaMail.zimbra@redhat.com> <20141126072147.GO3212@norris-Latitude-E6410> <1417070032.4547583.1417007972343.JavaMail.zimbra@redhat.com> <20150224080752.GF24441@norris-Latitude-E6410> <54EC344F.3050709@openwrt.org> <20150224082725.GG24441@norris-Latitude-E6410> In-Reply-To: <20150224082725.GG24441@norris-Latitude-E6410> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2442 Lines: 56 On 2015-02-24 21:27, Brian Norris wrote: > On Tue, Feb 24, 2015 at 09:20:31PM +1300, Felix Fietkau wrote: >> On 2015-02-24 21:07, Brian Norris wrote: >> > On Wed, Nov 26, 2014 at 08:19:32AM -0500, Rodrigo Freire wrote: >> >> From: "Brian Norris" >> >> Sent: Wednesday, November 26, 2014 5:21:47 AM >> >> Subject: Re: [PATCH v3 3/3] mtd: block2mtd: Removes PAGE_MASK as a index to >> >> partition size >> >> >> >> > On Sun, Nov 09, 2014 at 07:23:12AM -0500, Rodrigo Freire wrote: >> >> > > - dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; >> >> > > + dev->mtd.size = dev->blkdev->bd_inode->i_size & ~(erase_size - 1); >> >> >> >> > You never guaranteed that erase_size is a power of two, so this doesn't >> >> > necessarily mask the way you'd like... >> >> >> >> > But also, why is this even necessary? I see that we should already have >> >> > errored out if this was actually significant, since we have above: >> >> >> >> > if ((long)dev->blkdev->bd_inode->i_size % erase_size) { >> >> > pr_err("erasesize must be a divisor of device size\n"); >> >> > goto err_free_block2mtd; >> >> > } >> >> >> >> Hello Brian, and thanks for the review. >> >> >> >> Honestly, I'd leave that untouched, but J?rn pointed that it could be a issue at https://lkml.org/lkml/2014/9/9/680 >> >> >> >> I'd happily let it go without this patch 3, unless J?rg wants to state otherwise. >> > >> > OK let's drop this patch from the series. At best, we could just do >> > something like this instead: >> > >> > - dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; >> > + dev->mtd.size = dev->blkdev->bd_inode->i_size; >> > >> > But that's really just an unnecessary change. >> If I remember correctly, it was problematic to have a dev->mtd.size >> value which is not a multiple of the erase size. I think that was the >> reason for patch 3. > > The what's this for? > > if ((long)dev->blkdev->bd_inode->i_size % erase_size) { > pr_err("erasesize must be a divisor of device size\n"); > goto err_free_block2mtd; > } I think we should just trim the mtd size to a multiple of erase size and remove this check. It is a bit impractical for many cases. - Felix -- 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/