Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp521834pxa; Tue, 11 Aug 2020 08:36:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygBGyrF+skmjvhialfglNzL8I+UpImRQ9ny7vbftNf+nYrlWJP1sUbq7il1EKIJEuOcX6p X-Received: by 2002:a17:907:2078:: with SMTP id qp24mr1842888ejb.286.1597160197737; Tue, 11 Aug 2020 08:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597160197; cv=none; d=google.com; s=arc-20160816; b=NIsLGudG2qp5+BHOX06ZFGpyD/mdq2beYvKNyj5TpaQEsJYmkoXWHCQcPWwnSXGevU v3WDG6W56zuJSv00dHbtdMdMEAg3qjMzT1bbMBPJAYlgaSetnuig+856ipURRoff8vyK fNAKhyE+WUK0O0fBN6Z5pEOBAgQo6hbDm53HdXL/9Z3JkBLZ+4tiE96XZr1UaGSQMD80 QJV5aI/OgcFtLYlDQSAZ9AzM1/4nNHtd2Y45o5y/D3HPMXQCSwRGTSDHNGSG62EBJIZo gh8N+8D7cX2lh2GqcFzR5WIa4CSrHPxuv68+ck5MmK9cKVV9G33m4jXjBdypu4qJt/N3 rByA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=4GbFoy2Wx5FvH0B101UxN/Bc0pyLUue1u4T1+YJ5sfg=; b=oYyeJeK4QgbrTUK0hU1WHcdDoT+oelYSXLGjy5d9ehU0nSW2KIbrj3NTnN1K0YQ6ky 7RcTfUV262R8njxY37rSoBtMpwbqBbZ6udqePE09XKhYLvyymyXwi20EBKojAppQOigV I0pZfFI96kOyn5dGVewSXbcaNoE4YibnhXz2pDjHkxS0ULESovsKDajNDGLWwnlTFbvV Q5KU3hr5vme2/xwOpivI8zB1mmUM/UbKSNcw4/svLA21qPaEeLFXgaZoHcSVE8P4DhaP ygRIKq5+MarZdH8yBjcalbtQEgxrmQ1EHV5/IvKHoH3lpK9QA45XROR9WECJMP+hYyg3 hiBA== 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 q6si12695302edn.165.2020.08.11.08.36.04; Tue, 11 Aug 2020 08:36:37 -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 S1728971AbgHKPdj (ORCPT + 99 others); Tue, 11 Aug 2020 11:33:39 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:38365 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728859AbgHKPdj (ORCPT ); Tue, 11 Aug 2020 11:33:39 -0400 X-IronPort-AV: E=Sophos;i="5.75,461,1589212800"; d="scan'208";a="97995540" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Aug 2020 23:33:24 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id CC48C4CE34E6; Tue, 11 Aug 2020 23:33:19 +0800 (CST) Received: from [10.167.220.69] (10.167.220.69) by G08CNEXMBPEKD06.g08.fujitsu.local (10.167.33.206) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 11 Aug 2020 23:33:21 +0800 Message-ID: <5F32BA3E.90801@cn.fujitsu.com> Date: Tue, 11 Aug 2020 23:33:18 +0800 From: Xiao Yang User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.2; zh-CN; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: Ira Weiny CC: , , , Subject: Re: [PATCH v2] chattr/lsattr: Support dax attribute References: <20200728053321.12892-1-yangx.jy@cn.fujitsu.com> <20200807160305.GQ1573827@iweiny-DESK2.sc.intel.com> In-Reply-To: <20200807160305.GQ1573827@iweiny-DESK2.sc.intel.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.220.69] X-ClientProxiedBy: G08CNEXCHPEKD06.g08.fujitsu.local (10.167.33.205) To G08CNEXMBPEKD06.g08.fujitsu.local (10.167.33.206) X-yoursite-MailScanner-ID: CC48C4CE34E6.AE4B1 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangx.jy@cn.fujitsu.com X-Spam-Status: No Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 2020/8/8 0:03, Ira Weiny wrote: > On Tue, Jul 28, 2020 at 01:33:21PM +0800, Xiao Yang wrote: >> Use the letter 'x' to set/get dax attribute on a directory/file. >> >> Signed-off-by: Xiao Yang >> --- >> >> V1->V2: >> 1) Define FS_DAX_FL in order and add missing 'x' letter in manpage. >> 2) Add more detailed description about 'x' attribute. >> 3) 'x' is a separate attribute and doesn't always affect S_DAX(i.e. >> pagecache bypass) so remove the related info. >> >> lib/e2p/pf.c | 1 + >> lib/ext2fs/ext2_fs.h | 1 + >> misc/chattr.1.in | 15 ++++++++++++--- >> misc/chattr.c | 3 ++- >> 4 files changed, 16 insertions(+), 4 deletions(-) >> >> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c >> index 0c6998c4..e59cccff 100644 >> --- a/lib/e2p/pf.c >> +++ b/lib/e2p/pf.c >> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = { >> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" }, >> { EXT4_EXTENTS_FL, "e", "Extents" }, >> { FS_NOCOW_FL, "C", "No_COW" }, >> + { FS_DAX_FL, "x", "Dax" }, >> { EXT4_CASEFOLD_FL, "F", "Casefold" }, >> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" }, >> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" }, >> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h >> index 6c20ea77..88f510a3 100644 >> --- a/lib/ext2fs/ext2_fs.h >> +++ b/lib/ext2fs/ext2_fs.h >> @@ -335,6 +335,7 @@ struct ext2_dx_tail { >> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */ >> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */ >> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */ >> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */ > Per-file support is not supported on ext2... > > So I'm suspicious of this change. It is probably not an issue but I just > wanted to check if you are trying to test on ext2? Hi Ira, Thanks for your reply. :-) chattr failed to set the 'x' flag on ext2 sliently because ext2_ioctl() in kernel drops unsupported 'FS_DAX_FL' sliently: ---------------------------------------------- # touch file # chattr +x file;echo $? 0 # lsattr file --------------------- file ---------------------------------------------- ext2_ioctl() drops all unsupported flags sliently(see the following code) so I am not sure if we should return -EOPNOTSUPP for the unsupported FS_DAX_FL: ---------------------------------------------- long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ... case EXT2_IOC_SETFLAGS: { ... flags = flags & EXT2_FL_USER_MODIFIABLE; flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE; ei->i_flags = flags; ext2_set_inode_flags(inode); ... ---------------------------------------------- Best Regards, Xiao Yang > Ira > >> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */ >> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */ >> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */ >> diff --git a/misc/chattr.1.in b/misc/chattr.1.in >> index ff2fcf00..5a4928a5 100644 >> --- a/misc/chattr.1.in >> +++ b/misc/chattr.1.in >> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system >> .B chattr >> changes the file attributes on a Linux file system. >> .PP >> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu]. >> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux]. >> .PP >> The operator '+' causes the selected attributes to be added to the >> existing attributes of the files; '-' causes them to be removed; and '=' >> causes them to be the only attributes that the files have. >> .PP >> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files: >> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files: >> append only (a), >> no atime updates (A), >> compressed (c), >> @@ -45,7 +45,8 @@ secure deletion (s), >> synchronous updates (S), >> no tail-merging (t), >> top of directory hierarchy (T), >> -and undeletable (u). >> +undeletable (u), >> +and direct access for files (x). >> .PP >> The following attributes are read-only, and may be listed by >> .BR lsattr (1) >> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please >> make sure to read the bugs and limitations section at the end of this >> document. >> .TP >> +.B x >> +The 'x' attribute can be set on a directory or file. If the attribute >> +is set on an existing directory, it will be inherited by all files and >> +subdirectories that are subsequently created in the directory. If an >> +existing directory has contained some files and subdirectories, modifying >> +the attribute on the parent directory doesn't change the attributes on >> +these files and subdirectories. >> +.TP >> .B V >> A file with the 'V' attribute set has fs-verity enabled. It cannot be >> written to, and the filesystem will automatically verify all data read >> diff --git a/misc/chattr.c b/misc/chattr.c >> index a5d60170..c0337f86 100644 >> --- a/misc/chattr.c >> +++ b/misc/chattr.c >> @@ -86,7 +86,7 @@ static unsigned long sf; >> static void usage(void) >> { >> fprintf(stderr, >> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"), >> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"), >> program_name); >> exit(1); >> } >> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = { >> { EXT2_NOTAIL_FL, 't' }, >> { EXT2_TOPDIR_FL, 'T' }, >> { FS_NOCOW_FL, 'C' }, >> + { FS_DAX_FL, 'x' }, >> { EXT4_CASEFOLD_FL, 'F' }, >> { 0, 0 } >> }; >> -- >> 2.21.0 >> >> >> > > . >