From patchwork Fri Jan 6 20:53:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 9501793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 28E2D60413 for ; Fri, 6 Jan 2017 20:54:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E8A928524 for ; Fri, 6 Jan 2017 20:54:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1378C28528; Fri, 6 Jan 2017 20:54:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0F3E28524 for ; Fri, 6 Jan 2017 20:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161782AbdAFUyb (ORCPT ); Fri, 6 Jan 2017 15:54:31 -0500 Received: from mailrelay112.isp.belgacom.be ([195.238.20.139]:7405 "EHLO mailrelay112.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161631AbdAFUyX (ORCPT ); Fri, 6 Jan 2017 15:54:23 -0500 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2DJAgADA3BY/2ZisVteHQEFAQsBgzkBA?= =?us-ascii?q?QEBAR9AgSuNV3KRVgGQLYJDgg+CCYYiAoFVQBQBAgEBAQEBAQFjKIRpBicvIxA?= =?us-ascii?q?ZJhI5HgYTiGMRsjQ6ih8BAQgohkWPDQWIcowohXuRRwKQWUiSCR84gSEYGIReH?= =?us-ascii?q?IFgPTWIZgEBAQ?= X-IPAS-Result: =?us-ascii?q?A2DJAgADA3BY/2ZisVteHQEFAQsBgzkBAQEBAR9AgSuNV3K?= =?us-ascii?q?RVgGQLYJDgg+CCYYiAoFVQBQBAgEBAQEBAQFjKIRpBicvIxAZJhI5HgYTiGMRs?= =?us-ascii?q?jQ6ih8BAQgohkWPDQWIcowohXuRRwKQWUiSCR84gSEYGIReHIFgPTWIZgEBAQ?= Received: from 102.98-177-91.adsl-dyn.isp.belgacom.be (HELO inkjet2.lan) ([91.177.98.102]) by relay.skynet.be with ESMTP; 06 Jan 2017 21:54:15 +0100 From: Fabian Frederick To: Jan Kara Cc: fabf@skynet.be, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents() Date: Fri, 6 Jan 2017 21:53:55 +0100 Message-Id: <1483736037-25111-8-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483736037-25111-1-git-send-email-fabf@skynet.be> References: <1483736037-25111-1-git-send-email-fabf@skynet.be> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP recalculate offset if needed. Signed-off-by: Fabian Frederick --- 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; } } }