From patchwork Tue Sep 11 15:42:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kani, Toshi" X-Patchwork-Id: 10595839 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 063BD14BD for ; Tue, 11 Sep 2018 16:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7DC3298FA for ; Tue, 11 Sep 2018 16:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC08729943; Tue, 11 Sep 2018 16:03:28 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F913298FA for ; Tue, 11 Sep 2018 16:03:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5B2352112870E; Tue, 11 Sep 2018 09:03:28 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=15.233.44.25; helo=g2t2352.austin.hpe.com; envelope-from=toshi.kani@hpe.com; receiver=linux-nvdimm@lists.01.org Received: from g2t2352.austin.hpe.com (g2t2352.austin.hpe.com [15.233.44.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CCFD221B02822 for ; Tue, 11 Sep 2018 09:03:26 -0700 (PDT) Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2352.austin.hpe.com (Postfix) with ESMTP id E7A91B1; Tue, 11 Sep 2018 16:03:25 +0000 (UTC) Received: from misato.americas.hpqcorp.net (unknown [10.34.81.122]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id 79EBE36; Tue, 11 Sep 2018 16:03:25 +0000 (UTC) From: Toshi Kani To: jack@suse.cz, dan.j.williams@intel.com Subject: [PATCH 1/2] ext4, dax: update dax check to skip journal inode Date: Tue, 11 Sep 2018 09:42:45 -0600 Message-Id: <20180911154246.6844-2-toshi.kani@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180911154246.6844-1-toshi.kani@hpe.com> References: <20180911154246.6844-1-toshi.kani@hpe.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tytso@mit.edu, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Ext4 mount path calls ext4_iget() to obtain the journal inode. This inode does not support DAX, and 'ext4_da_aops' needs to be set. It currently works for the DAX mount case because ext4_iget() always set 'ext4_da_aops' to any regular files. ext4_fill_super ext4_load_journal ext4_get_journal_inode ext4_iget In preparation to fix ext4_iget() to set 'ext4_dax_aops' for DAX files, update ext4_should_use_dax() to return false for the journal inode. Fixes: 5f0663bb4a64f588f0a2dd6d1be68d40f9af0086 Signed-off-by: Toshi Kani Cc: Jan Kara Cc: Dan Williams Cc: "Theodore Ts'o" Cc: Andreas Dilger Reviewed-by: Dan Williams --- fs/ext4/ext4_jbd2.h | 8 ++++++++ fs/ext4/inode.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h index 15b6dd733780..9847dc980a0d 100644 --- a/fs/ext4/ext4_jbd2.h +++ b/fs/ext4/ext4_jbd2.h @@ -437,6 +437,14 @@ static inline int ext4_should_writeback_data(struct inode *inode) return ext4_inode_journal_mode(inode) & EXT4_INODE_WRITEBACK_DATA_MODE; } +static inline int ext4_is_journal_inode(struct inode *inode) +{ + struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); + unsigned int journal_inum = le32_to_cpu(sbi->s_es->s_journal_inum); + + return journal_inum && (journal_inum == inode->i_ino); +} + /* * This function controls whether or not we should try to go down the * dioread_nolock code paths, which makes it safe to avoid taking diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d0dd585add6a..775cd9b4af55 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4686,6 +4686,8 @@ static bool ext4_should_use_dax(struct inode *inode) return false; if (ext4_should_journal_data(inode)) return false; + if (ext4_is_journal_inode(inode)) + return false; if (ext4_has_inline_data(inode)) return false; if (ext4_encrypted_inode(inode)) From patchwork Tue Sep 11 15:42:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kani, Toshi" X-Patchwork-Id: 10595841 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4AB58112B for ; Tue, 11 Sep 2018 16:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39CC3298FA for ; Tue, 11 Sep 2018 16:03:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D8FD2993F; Tue, 11 Sep 2018 16:03:29 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7897329941 for ; Tue, 11 Sep 2018 16:03:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6E2EB21959CB2; Tue, 11 Sep 2018 09:03:28 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=15.233.44.26; helo=g2t2353.austin.hpe.com; envelope-from=toshi.kani@hpe.com; receiver=linux-nvdimm@lists.01.org Received: from g2t2353.austin.hpe.com (g2t2353.austin.hpe.com [15.233.44.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B42EA21106C68 for ; Tue, 11 Sep 2018 09:03:27 -0700 (PDT) Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2353.austin.hpe.com (Postfix) with ESMTP id 25AE577; Tue, 11 Sep 2018 16:03:27 +0000 (UTC) Received: from misato.americas.hpqcorp.net (unknown [10.34.81.122]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id AF96937; Tue, 11 Sep 2018 16:03:26 +0000 (UTC) From: Toshi Kani To: jack@suse.cz, dan.j.williams@intel.com Subject: [PATCH 2/2] ext4, dax: set ext4_dax_aops for dax files Date: Tue, 11 Sep 2018 09:42:46 -0600 Message-Id: <20180911154246.6844-3-toshi.kani@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180911154246.6844-1-toshi.kani@hpe.com> References: <20180911154246.6844-1-toshi.kani@hpe.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tytso@mit.edu, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Sync syscall to an existing DAX file needs to flush processor cache, but it does not currently. This is because 'ext4_da_aops' is set to address_space_operations of existing DAX files, instead of 'ext4_dax_aops', since S_DAX flag is set after ext4_set_aops() in the open path. New file -------- lookup_open ext4_create __ext4_new_inode ext4_set_inode_flags // Set S_DAX flag ext4_set_aops // Set aops to ext4_dax_aops Existing file ------------- lookup_open ext4_lookup ext4_iget ext4_set_aops // Set aops to ext4_da_aops ext4_set_inode_flags // Set S_DAX flag Change ext4_iget() to call ext4_set_inode_flags() before ext4_set_aops(). Fixes: 5f0663bb4a64f588f0a2dd6d1be68d40f9af0086 Signed-off-by: Toshi Kani Cc: Jan Kara Cc: Dan Williams Cc: "Theodore Ts'o" Cc: Andreas Dilger --- fs/ext4/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 775cd9b4af55..93cbbb859c40 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4998,6 +4998,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) if (ret) goto bad_inode; + ext4_set_inode_flags(inode); + if (S_ISREG(inode->i_mode)) { inode->i_op = &ext4_file_inode_operations; inode->i_fop = &ext4_file_operations; @@ -5043,7 +5045,6 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) goto bad_inode; } brelse(iloc.bh); - ext4_set_inode_flags(inode); unlock_new_inode(inode); return inode;