Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2418507pxb; Tue, 13 Apr 2021 01:06:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVbDU4DtW1SjuLUC0iy+ZXyQoT7fbunAu8Hg0T7kmiFyC5ZpBNaFIQLJCUmL1euK4p84/T X-Received: by 2002:a05:6402:1013:: with SMTP id c19mr33513057edu.213.1618301199758; Tue, 13 Apr 2021 01:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618301199; cv=none; d=google.com; s=arc-20160816; b=hv0BeRj2fvr88d1W8jc2npsdi+WxYtdGiIOLCeIdobAbSRJydAWrF5dS9S+wHpZlFK CaxVDTWqIXAFbBmqnJw41Y3HQAiqJYJUYU3jig+cHZ3EtwDJkxa42kZgA0bCfKYdorj0 ZtdnZAODKdF1XEyc+iYyYqjXnz5MOB5uRafoQJQ9b9RlRl2W7Kssugh5MtU1q7W+BhJw bRdcBfojosCaCuSt09z4rq94rsN/0Wp4JusNklvw+UJJzIVyjLem88LGeUMHwUlovNoB vFl7sRAz1V2SFg3E1V+4R/HBUJibDe8JlUXA75Qp76AnLkUnHCzv2YM4D4oU1iN1U7tI pP4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=+EyAQ5iHYdgyDrz8YL9yxiieAGmebWhHRcGmdOlxHY0=; b=JRegLr8e9pDtSwG+gtPlsHAZx/ekMp+uubr6xf2b36//3vxxJquCCcuB9uj7WGRPrV OoMIOh4xI3Hb9dPZjwNEnc+WXb6SiwKwHxYjbUCBBxSXIk8CFPqK5UHOp236oFScJ6/O 5ZtA9ej3NS8JJy1NsFfy+qQTjmdDxcq3Y6T1Ndu9HOoKrvsn5BYpjXkQwlCn/9CweZz9 wDO+vFqmeujouh9vTsuNtmvwU0FW5nszJdwLi+NDSfmxrJ+qJwqfhMRJowdkZJc52m4+ hNS9dZ8pfIPgAFEhGgYsIOm4b8xZRmCZr0zvdDnX+8iMFWzAF6C+nFdI5PDioU3CmgTQ FGyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj11si4208640ejb.660.2021.04.13.01.06.14; Tue, 13 Apr 2021 01:06:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245500AbhDMDb5 (ORCPT + 99 others); Mon, 12 Apr 2021 23:31:57 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:45503 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241613AbhDMDb5 (ORCPT ); Mon, 12 Apr 2021 23:31:57 -0400 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 13D3VX6q000587 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Apr 2021 23:31:33 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 2EB1715C3B1E; Mon, 12 Apr 2021 23:31:33 -0400 (EDT) From: "Theodore Ts'o" To: Ext4 Developers List Cc: "Theodore Ts'o" , stable@kernel.org Subject: [PATCH] ext4: allow the dax flag to be set and cleared on inline directories Date: Mon, 12 Apr 2021 23:31:24 -0400 Message-Id: <20210413033124.2256508-1-tytso@mit.edu> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This is needed to allow generic/620 to pass for file systems with the inline data_feature enabled, and it allows the use of file systems where the directories use inline_data, while the files are accessed via DAX. Cc: stable@kernel.org Signed-off-by: Theodore Ts'o --- fs/ext4/ialloc.c | 3 ++- fs/ext4/ioctl.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 5f0c7fe32672..71d321b3b984 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -1292,7 +1292,8 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns, ei->i_extra_isize = sbi->s_want_extra_isize; ei->i_inline_off = 0; - if (ext4_has_feature_inline_data(sb)) + if (ext4_has_feature_inline_data(sb) && + (!(ei->i_flags & EXT4_DAX_FL) || S_ISDIR(mode))) ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); ret = inode; err = dquot_alloc_inode(inode); diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index a2cf35066f46..0796bfa72829 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -315,6 +315,12 @@ static void ext4_dax_dontcache(struct inode *inode, unsigned int flags) static bool dax_compatible(struct inode *inode, unsigned int oldflags, unsigned int flags) { + /* Allow the DAX flag to be changed on inline directories */ + if (S_ISDIR(inode->i_mode)) { + flags &= ~EXT4_INLINE_DATA_FL; + oldflags &= ~EXT4_INLINE_DATA_FL; + } + if (flags & EXT4_DAX_FL) { if ((oldflags & EXT4_DAX_MUT_EXCL) || ext4_test_inode_state(inode, -- 2.31.0