From patchwork Fri Jan 6 20:53:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 9501823 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 4D9476021C for ; Fri, 6 Jan 2017 20:56:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42B3128526 for ; Fri, 6 Jan 2017 20:56:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34B4E28528; Fri, 6 Jan 2017 20:56:55 +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=unavailable 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 E478228526 for ; Fri, 6 Jan 2017 20:56:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161751AbdAFUyZ (ORCPT ); Fri, 6 Jan 2017 15:54:25 -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 S1161708AbdAFUyT (ORCPT ); Fri, 6 Jan 2017 15:54:19 -0500 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2DJAgADA3BY/2ZisVteHQEFAQsBgzkBA?= =?us-ascii?q?QEBAR9AgSuNV3KRVgGScIIPggmGIgKBVUAUAQIBAQEBAQEBYyiEaQYnLyMQGSY?= =?us-ascii?q?SOR4GE4hjEbI0OoofAQEBByiGRY8NBYhyjCiFe5FHApBZklEfOIEhGBiGWj01i?= =?us-ascii?q?GYBAQE?= X-IPAS-Result: =?us-ascii?q?A2DJAgADA3BY/2ZisVteHQEFAQsBgzkBAQEBAR9AgSuNV3K?= =?us-ascii?q?RVgGScIIPggmGIgKBVUAUAQIBAQEBAQEBYyiEaQYnLyMQGSYSOR4GE4hjEbI0O?= =?us-ascii?q?oofAQEBByiGRY8NBYhyjCiFe5FHApBZklEfOIEhGBiGWj01iGYBAQE?= 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:09 +0100 From: Fabian Frederick To: Jan Kara Cc: fabf@skynet.be, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 03/12 linux-next] udf: merge bh free Date: Fri, 6 Jan 2017 21:53:51 +0100 Message-Id: <1483736037-25111-4-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 Merge all bh free at one place. Signed-off-by: Fabian Frederick --- fs/udf/inode.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 4a7813b..5cac1c3 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -745,11 +745,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, ~(inode->i_sb->s_blocksize - 1)); udf_write_aext(inode, &cur_epos, &eloc, elen, 1); } - brelse(prev_epos.bh); - brelse(cur_epos.bh); - brelse(next_epos.bh); newblock = udf_get_lb_pblock(inode->i_sb, &eloc, offset); - return newblock; + goto out_free; } /* Are we beyond EOF? */ @@ -772,11 +769,9 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, /* Create extents for the hole between EOF and offset */ ret = udf_do_extend_file(inode, &prev_epos, laarr, offset); if (ret < 0) { - brelse(prev_epos.bh); - brelse(cur_epos.bh); - brelse(next_epos.bh); *err = ret; - return 0; + newblock = 0; + goto out_free; } c = 0; offset = 0; @@ -839,11 +834,9 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, iinfo->i_location.partitionReferenceNum, goal, err); if (!newblocknum) { - brelse(prev_epos.bh); - brelse(cur_epos.bh); - brelse(next_epos.bh); *err = -ENOSPC; - return 0; + newblock = 0; + goto out_free; } if (isBeyondEOF) iinfo->i_lenExtents += inode->i_sb->s_blocksize; @@ -870,15 +863,11 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, * the new number of extents is less than the old number */ udf_update_extents(inode, laarr, startnum, endnum, &prev_epos); - brelse(prev_epos.bh); - brelse(cur_epos.bh); - brelse(next_epos.bh); - newblock = udf_get_pblock(inode->i_sb, newblocknum, iinfo->i_location.partitionReferenceNum, 0); if (!newblock) { *err = -EIO; - return 0; + goto out_free; } *new = 1; iinfo->i_next_alloc_block = block; @@ -889,7 +878,10 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, udf_sync_inode(inode); else mark_inode_dirty(inode); - +out_free: + brelse(prev_epos.bh); + brelse(cur_epos.bh); + brelse(next_epos.bh); return newblock; }