From patchwork Tue Oct 24 15:24:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 829944 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yLxtl0L6bz9t2c for ; Wed, 25 Oct 2017 02:26:07 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932528AbdJXPZ7 (ORCPT ); Tue, 24 Oct 2017 11:25:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:36144 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932400AbdJXPZe (ORCPT ); Tue, 24 Oct 2017 11:25:34 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 53009AD7F; Tue, 24 Oct 2017 15:25:28 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 7279A1E35DC; Tue, 24 Oct 2017 17:25:27 +0200 (CEST) From: Jan Kara To: Dan Williams Cc: Ross Zwisler , Christoph Hellwig , , linux-nvdimm@lists.01.org, , , linux-api@vger.kernel.org, , Jan Kara Subject: [PATCH 15/17] ext4: Simplify error handling in ext4_dax_huge_fault() Date: Tue, 24 Oct 2017 17:24:12 +0200 Message-Id: <20171024152415.22864-16-jack@suse.cz> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20171024152415.22864-1-jack@suse.cz> References: <20171024152415.22864-1-jack@suse.cz> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org If transaction starting fails, just bail out of the function immediately instead of checking for that condition throughout the function. Reviewed-by: Ross Zwisler Signed-off-by: Jan Kara --- fs/ext4/file.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 3cec0b95672f..208adfc3e673 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -302,16 +302,17 @@ static int ext4_dax_huge_fault(struct vm_fault *vmf, down_read(&EXT4_I(inode)->i_mmap_sem); handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE, EXT4_DATA_TRANS_BLOCKS(sb)); + if (IS_ERR(handle)) { + up_read(&EXT4_I(inode)->i_mmap_sem); + sb_end_pagefault(sb); + return VM_FAULT_SIGBUS; + } } else { down_read(&EXT4_I(inode)->i_mmap_sem); } - if (!IS_ERR(handle)) - result = dax_iomap_fault(vmf, pe_size, NULL, &ext4_iomap_ops); - else - result = VM_FAULT_SIGBUS; + result = dax_iomap_fault(vmf, pe_size, NULL, &ext4_iomap_ops); if (write) { - if (!IS_ERR(handle)) - ext4_journal_stop(handle); + ext4_journal_stop(handle); up_read(&EXT4_I(inode)->i_mmap_sem); sb_end_pagefault(sb); } else {