From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796513976; b=Q2KvLV+WMCZbj+StgoAj46hHH17S82jVj/APjarQMd7kSQCUAV6o45EQVcw5/fzcG9lt ONB0fR/9+GHOjClqbCX3RSnUpN0+0rIIf8Ihu8d2DvqsVUn+Fhi9yREF5KZs9MUT5aaS2 H4LAML5HhQzXLH1GX46QfOjSEfIrGEpG0cVPj0DJjo7UtgEqhkqheYpQaDM3iLLZdrcw9 Bh/YOhti4SF3GTngOg6QSgwvm5zediKkqlTSt/r0NJu2IyKOrF+ZR4DrIlEI2yxRpmLqp BcAPdRS9byCBhCXA8wkaJMYcOoHdowlxOevoNLojheitZ3CQ8YPb502SY58r4omRZ9g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796513976; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To:X-Mailer: References:In-Reply-To; bh=g+Vj79YN5gERc5UuMWmxdqdYaT01qKIrEwv00IXZ8J4=; b=tMv4yHF2CPfSI3RtVqwtaDraNC/cVFk5Uky8N4+JEhPDZIl4aTQTUDcBAQTBjykY7du+ 1+58/M+qfr/9qhxoMcuqaCW+Pw0PUAuEvAwruNg3ZMilpPnNpf+rqfhGbfYOuhANtyhL+ +GLZ1cVrWZJaRleBD01/aQsISWNO0rmHnVVIpt2B032p7/NKM8wImkHGUXMD9NlL38Lf1 4SEw7G1ohKA2ZxyJ/jRLKje1I5E5EebF8TKiH8KS9HodWJJ5gzLE77FM2wFDQkcVZ/w54 pflcGwZTH6QK0JuYhZK/xklHXAq7MO41Kon+m74I5qUU3o8GW6X6ldBP7l3IVCMdGIw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=aExpo0KH; arc=none smtp.remote-ip=209.85.128.44 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29176606A334 for ; Sat, 5 Dec 2026 23:39:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 29176606A334 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=aExpo0KH Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4a3517554f7so18556415e9.2 for ; Sat, 05 Dec 2026 15:39:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796513974; x=1797118774; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:mime-version:from:to:cc:subject:date:message-id :reply-to:content-type; bh=g+Vj79YN5gERc5UuMWmxdqdYaT01qKIrEwv00IXZ8J4=; b=aExpo0KHnpzvD//gkUgMGh9JbSOYZTunIpf8D1Xtqet2zj936P1JRyLSlBOwhAiIGq rqhMurq2TCp43qLIqJLdb/bRtEf02Si049ce5e+KAAzCeYgZgtVGY0R4lptBeQb0sjTD O+q+mJFVGAGi1fWEYOPAaQGKgwN1coNJ/PJew2oFBd6s75eIfRZlUCrdNZ9cQfBTyxwd uEJN19XDAGY8gI0vOj+ndidphlB/adz1L02V2Z26Z69irrkTNJVY+IaU4Oy66oLY71Nw xZCciqLSX/J1k9A05NTXC17ennwR6D80XCPVa3DrW1yAYG1bRDR7KscguYABB4Le6Kn5 5PqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796513974; x=1797118774; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=g+Vj79YN5gERc5UuMWmxdqdYaT01qKIrEwv00IXZ8J4=; b=bKs5ouV2xFI4eluPEIvXD9KvYd3MpL7t90TrlE0CnIb8XtihPRYed5/J7YB16BDE7+ VJNymDxE2eFSiZujt2CJ7QhGDH6FnBo9x8V0yxmNkoY6lhmGHxNDCqgtI4a+2rd4Enw7 WaCQ2GajN3IJuj12S+CQeS9a0ovl6w2mLRfjxi1JFFlpp5MR6CuanUhNJqxpNGzPlYvO yblNWyPM5D0Rl173moDRAAR7aR6IeqZCOa80j0LmEYY6dfKZ/Kqjm6FzHi/yHlGULRit qcMxNp8wXGe0pw0q8B4gCi09BvWq41FaYIMmRCo6KVJQeQNryXL/jIqtmkCateY1Iw6m sHNw== X-Forwarded-Encrypted: i=1; AL+hErFjTfXT41uk4paGohNDJy6FwtviV3ejdDhcM5eIw7G8EWmLpdRArgheMFypmU+d/LVnUP5iDrhx2ESnKOHM@vger.kernel.org X-Gm-Message-State: APuU4Z+Wi1DwoG3EryQjD+JkDOgVG4ExA3kq8WLJ3fiEj7QzIz7rH+8p 7ZlkDdc3Z0c7aczRhiqzN5gOBKkihBbjyWW1IHxGDhBFqYr5wDb1gSiT X-Gm-Gg: AZFdTZd4/9nqurvwFKyGKg9XOJ7fIXUcVXQEPLU8NtlkNOmdgd8mecQIj0jaXacsdHr 5q6P7SnlBjC+Vslaepzl+c9Kb2/k0txfg2kBAvOkO8LD3F2iAfkYioT73Ij7OOhhJs73UJTsgHo aphqmPLWy4WJZ0UGE3NPbzBp0ScB2khCQGdEJYz6vVFRmuRwi5FpHHVTt5BzserPCfKV49AzezI uD3wJVpgfZhN0EFJd6U4/ovn0IyXhR6TkKKeC7rc/GrbILUB4+Rsb+wEESYz7HzI/xNfs29jvEy WTcdSDkHJ3QmP+KBxttlx1CHdn8mEbQqmRCZcZjiMcSpGorHeic1V+ofJIKDDkRzspjOkIs8rRQ Ayi95dhWzRZMd+SZWY0ubaLfY7aSsgxNQTjSPTwRYKPt0UEVlf7b97iKZ5Ln4N3+kJk23I9hrZ2 NeySiCKUo8cBjrjMW1nhrCGepHjUlbU77+jlpkzUUtuC153S1efpdCDMORAx/IkZv88f67bD8fs wq+LkXrglnr2EVYQOc/+NwZNQbIqBcWP7XwN+6J0CdP0CtuETyK6Uz+B8/Cs78i5i75dRqNR2RD 6pnh/k1bZ0YTeKMR/kufPWpnNg== X-Received: by 2002:a05:600c:34d2:b0:4bb:8701:bb14 with SMTP id 5b1f17b1804b1-4bbeb879de4mr126003965e9.5.1796513974425; Sat, 05 Dec 2026 15:39:34 -0800 (PST) Received: from localhost ([2001:b07:5d26:7a6a:365a:60ff:fe0d:cfc6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbea09a089sm305683235e9.1.2026.12.05.15.39.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 05 Dec 2026 15:39:33 -0800 (PST) X-Mailing-List: linux-unionfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Type: multipart/signed; boundary=e3ab99958b4fb5490af4270b75bde387676e8616c005bc8426fc967134dc; micalg=pgp-sha512; protocol="application/pgp-signature" Date: Sun, 06 Dec 2026 00:39:32 +0100 Message-Id: Cc: "Namjae Jeon" , "Hyunchul Lee" , "Jonathan Corbet" , "Eric Biggers" , "Theodore Y . Ts'o" , "Jaegeuk Kim" , "Alexander Viro" , "Christian Brauner" , "Shuah Khan" , "Randy Dunlap" , "Chuck Lever" , "Jeff Layton" , "Jan Kara" , "Alexander Aring" , "Darrick J . Wong" , "Andrey Albershteyn" , "Miklos Szeredi" , =?utf-8?q?Pali_Roh=C3=A1r?= , "Lauri Gates" , "Christoph Hellwig" , "Dave Chinner" , , , , , , , , , Subject: Re: [PATCH v5 03/12] fs: move fileattr sizes out of uapi and factor out set_preserve() From: "koraynilay" To: "Amir Goldstein" , "koraynilay" X-Mailer: aerc 0.22.0-0-gc2f86b7abde3 References: <20261205142411.164484-1-koray.fra@gmail.com> <20261205142411.164484-4-koray.fra@gmail.com> In-Reply-To: --e3ab99958b4fb5490af4270b75bde387676e8616c005bc8426fc967134dc Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Sat Dec 5, 2026 at 11:15 PM CET, Amir Goldstein wrote: > On Sat, Dec 5, 2026 at 3:24=E2=80=AFPM koraynilay w= rote: >> >> Move FILE_ATTR_SIZE_* constants from the user-facing >> include/uapi/linux/fs.h to the internal include/linux/fileattr.h. >> >> Move old flags preservation from vfs_fileattr_set() to a dedicated >> helper in preparation for the addition of masks to the fileattr API. > > This is a combination of two very random unrelated things so no. Fair. > Please move the move of flags to the definition of VER1 unless > you have a good reason otherwise. Yeah, I did it like this because the robot suggested it and I thought it was a fine since it's a preparatory patch. (Moved the SIZE changes to the uapi patch now) > >> >> Signed-off-by: koraynilay >> --- >> fs/file_attr.c | 26 +++++++++++++++++--------- >> include/linux/fileattr.h | 4 ++++ >> include/uapi/linux/fs.h | 3 --- >> 3 files changed, 21 insertions(+), 12 deletions(-) >> >> diff --git a/fs/file_attr.c b/fs/file_attr.c >> index cc1621d3b710..77e2f1bc22ad 100644 >> --- a/fs/file_attr.c >> +++ b/fs/file_attr.c >> @@ -175,6 +175,22 @@ static int copy_fsxattr_from_user(struct file_kattr= *fa, >> return 0; >> } >> >> +static void fileattr_set_preserve(struct file_kattr *fa, >> + const struct file_kattr *old_ma) >> +{ >> + if (fa->flags_valid) { >> + /* FS_IOC_SETFLAGS */ >> + fa->fsx_xflags |=3D old_ma->fsx_xflags & ~FSX_COMMON; >> + fa->fsx_extsize =3D old_ma->fsx_extsize; >> + fa->fsx_nextents =3D old_ma->fsx_nextents; >> + fa->fsx_projid =3D old_ma->fsx_projid; >> + fa->fsx_cowextsize =3D old_ma->fsx_cowextsize; >> + } else { >> + /* FS_IOC_FSSETXATTR or file_setattr */ >> + fa->flags |=3D old_ma->flags & ~FS_COMMON_FL; >> + } >> +} >> + > > > Excellent way to make the code more readable and break into Nice. > understandable pieces but this non trivial helpers needs a comment to > explain what it does, similar to the not trivial comment that you added > above FSX_COMMON. Ah yeah, makes sense. Thanks, koraynilay > > Thanks, > Amir. > >> /* >> * Generic function to check FS_IOC_FSSETXATTR/FS_IOC_SETFLAGS values a= nd reject >> * any invalid configurations. >> @@ -289,15 +305,7 @@ int vfs_fileattr_set(const struct mnt_idmap *idmap,= struct dentry *dentry, >> goto out; >> >> /* initialize missing bits from old_ma */ >> - if (fa->flags_valid) { >> - fa->fsx_xflags |=3D old_ma.fsx_xflags & ~FSX_COMMON; >> - fa->fsx_extsize =3D old_ma.fsx_extsize; >> - fa->fsx_nextents =3D old_ma.fsx_nextents; >> - fa->fsx_projid =3D old_ma.fsx_projid; >> - fa->fsx_cowextsize =3D old_ma.fsx_cowextsize; >> - } else { >> - fa->flags |=3D old_ma.flags & ~FS_COMMON_FL; >> - } >> + fileattr_set_preserve(fa, &old_ma); >> >> err =3D fileattr_set_prepare(inode, &old_ma, fa); >> if (err) >> diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h >> index 79371aa93a61..d9e89e171f3e 100644 >> --- a/include/linux/fileattr.h >> +++ b/include/linux/fileattr.h >> @@ -3,6 +3,10 @@ >> #ifndef _LINUX_FILEATTR_H >> #define _LINUX_FILEATTR_H >> >> +/* Version UAPI's struct file_attr based on size */ >> +#define FILE_ATTR_SIZE_VER0 24 >> +#define FILE_ATTR_SIZE_LATEST FILE_ATTR_SIZE_VER0 >> + >> /* >> * FS_COMMON_FL/FSX_COMMON are preserved through an RMW cycle via eithe= r UAPI >> * flavor. They must NOT include flags that are read-write via one API = flavor >> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h >> index a13c7b32a1bd..f77e2b929f6d 100644 >> --- a/include/uapi/linux/fs.h >> +++ b/include/uapi/linux/fs.h >> @@ -240,9 +240,6 @@ struct file_attr { >> __u32 fa_cowextsize; /* CoW extsize field value (get/set) */ >> }; >> >> -#define FILE_ATTR_SIZE_VER0 24 >> -#define FILE_ATTR_SIZE_LATEST FILE_ATTR_SIZE_VER0 >> - >> /* >> * Flags for the fsx_xflags field >> */ >> -- >> 2.56.1.dirty >> --e3ab99958b4fb5490af4270b75bde387676e8616c005bc8426fc967134dc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSgVimKafU5DQMcjcDmj22qf5IGXAUCaxSgtAAKCRDmj22qf5IG XDYOAPkBPXI0PWeTIstR5LukrbDqlt1u4Y1wuWf91gALvX+/2wD/Qt29J/xGsQcS k4UaLw2CA78FqEKISZiwpCtx1OGgBQA= =1JoT -----END PGP SIGNATURE----- --e3ab99958b4fb5490af4270b75bde387676e8616c005bc8426fc967134dc--