From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965119AbdAJKxJ (ORCPT ); Tue, 10 Jan 2017 05:53:09 -0500 Received: from mx2.suse.de ([195.135.220.15]:52905 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964971AbdAJKxH (ORCPT ); Tue, 10 Jan 2017 05:53:07 -0500 Date: Tue, 10 Jan 2017 11:53:04 +0100 From: Jan Kara To: Fabian Frederick Cc: Jan Kara , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents() Message-ID: <20170110105304.GG4991@quack2.suse.cz> References: <1483736037-25111-1-git-send-email-fabf@skynet.be> <1483736037-25111-8-git-send-email-fabf@skynet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1483736037-25111-8-git-send-email-fabf@skynet.be> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 06-01-17 21:53:55, Fabian Frederick wrote: > recalculate offset if needed. > > Signed-off-by: Fabian Frederick IMHO not really worth it since numalloc gets updated and forgetting to update the byte variant is just too easy. Skipped. Honza > --- > fs/udf/inode.c | 21 +++++++++------------ > 1 file changed, 9 insertions(+), 12 deletions(-) > > diff --git a/fs/udf/inode.c b/fs/udf/inode.c > index f563e97..66514ad 100644 > --- a/fs/udf/inode.c > +++ b/fs/udf/inode.c > @@ -998,10 +998,10 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock, > length : UDF_DEFAULT_PREALLOC_BLOCKS) - > currlength); > if (numalloc) { > + loff_t pos = numalloc << inode->i_sb->s_blocksize_bits; > + > if (start == (c + 1)) > - laarr[start].extLength += > - (numalloc << > - inode->i_sb->s_blocksize_bits); > + laarr[start].extLength += pos; > else { > memmove(&laarr[c + 2], &laarr[c + 1], > sizeof(struct long_ad) * (*endnum - (c + 1))); > @@ -1011,9 +1011,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock, > laarr[c].extLocation. > partitionReferenceNum; > laarr[c + 1].extLength = > - EXT_NOT_RECORDED_ALLOCATED | > - (numalloc << > - inode->i_sb->s_blocksize_bits); > + EXT_NOT_RECORDED_ALLOCATED | pos; > start = c + 1; > } > > @@ -1024,12 +1022,12 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock, > inode->i_sb->s_blocksize_bits; > > if (elen > numalloc) { > - laarr[i].extLength -= > - (numalloc << > - inode->i_sb->s_blocksize_bits); > - numalloc = 0; > + laarr[i].extLength -= pos; > + numalloc = pos = 0; > } else { > numalloc -= elen; > + pos = numalloc << > + inode->i_sb->s_blocksize_bits; > if (*endnum > (i + 1)) > memmove(&laarr[i], > &laarr[i + 1], > @@ -1039,8 +1037,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock, > (*endnum)--; > } > } > - UDF_I(inode)->i_lenExtents += > - numalloc << inode->i_sb->s_blocksize_bits; > + UDF_I(inode)->i_lenExtents += pos; > } > } > } > -- > 2.7.4 > > -- Jan Kara SUSE Labs, CR