From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796567389; b=1bcgi488LEKZU5CuOaIATcEj4jfXAKBAxlHDuzDU90WVBJJPBBVZCM1PK6giV9oz1QzU RO02uYKehMf9JbS+SDFiW8TYXF10T4Qh9vu+ydyFZISuERA/wR8lBlzuEm5jBCVMgV5zt y3oPt8q+TDKfVW0TLRvj0PlmE9YuKCh+IMeIR9Koq5O7R4WBiHsavhjZ9L3H+1Dq7DSLf XDnUHJHofUr2pTR6Wv4ovcSAKvi6zXB81FFgMqLjHR1Ne7VKFbJEH0738lFUM8rz89SND rCFc1kxz1pgfxguTTIDivwvtp1e7o+qE2oTv6o5d8UNwnbD+n6P4oMrOWEiH+/5p/Gg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796567389; 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=DjKqPUPUJXAtCzzV8pMJFqZ0uOiJrtOJaXOmAJJ4ed8=; b=CB6sECln887S5LveVP8UpECLND+aluvE3F+z1L5wKEH8+P7jtOTk3imwC4zzVXxM/2Uw 72SgqvSS5A4hpWa+G0DZ5Fikl1M4a+oSbUJjDiAlhXWV2JYjHpWeBPWrO9I2bVNXhms06 aI222UIn2kwSryriLAFuNPzs1bMKlrd+HorcJpI4Mju9evv1RWlm9+Gxo7XXJ/R7gfOAR 249JxsCIHeB8LMf859v1BTOH9zU8HAZ4w7ugZdrgMdS+z+I8x3kw2MMzilr3XTbcCl3yh k5JDqsmVr5ayu9i78HO6VHVkroqDJkaNxFN+/4uegyOulmwtJyHwvFV6gzce/kUrhrg== 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=r3kvn2+v; arc=none smtp.remote-ip=209.85.221.43 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 8F1AC606A326 for ; Sun, 6 Dec 2026 14:29:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8F1AC606A326 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=r3kvn2+v Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-48e3b22e971so1194668f8f.0 for ; Sun, 06 Dec 2026 06:29:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796567388; x=1797172188; 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=DjKqPUPUJXAtCzzV8pMJFqZ0uOiJrtOJaXOmAJJ4ed8=; b=r3kvn2+va/0vIN15MJfj05SKSnUtYRTcQsbQI1vwmVptjO0+rSJzwsGe9Zd+TvZOWU fgH0puhqJRawfH+DgdBbmmpK6StJ331rzy/dpUsh0BX8M+3PLHpTvN6R10RlUnKTFjwW ljVJnuYBr5kTrgMgIoYRMJ9j5OIoc7Z08MNQ9li3mpwJDPZrDnEK1UxgIe0901ZVZx5P 1k77CIpcjFLTuArYq5XF3v5r68k64W0A0vNkaEICZKda7+VozUlO06D9a2nAtV99Qztv hECUndCF9HHIgM7/RXnaiNwOj6XweTqXQIsWEJ0nyfeuQU5ibK60AcV6uZLxhdcz62A+ 6F4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796567388; x=1797172188; 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=DjKqPUPUJXAtCzzV8pMJFqZ0uOiJrtOJaXOmAJJ4ed8=; b=z/lSUabNQ1LVZS/EJ3cIf9cNdvDlw8O8WpauBdnCKB3G56Ie5s5+gixVf4LaXwJpvV v6znuoFQ5QXNIqJHcLdRhoeMiqAWN5ZwM8ITUU88XJox2TsKMsFnPUTEiOxBk2LxDEHh b5dqU8nPiy2kYACXZ5Dstotk+FNrdIbLFymu/RawfU8YpgCnJFPCAfFzqBltq6YdZvXA FNDbPMcYExD3JaL7U72t6M7QNsfn3C7A9MRhlzxdIfHuOx+mLXh6cX9X3yGxlm/RoxwV fPhteHLnk/sUxewzGkvVTOE6TxbS+FAa7LrlxQqYKYy+5xv6xgJb0vkfy01VsC0iEife Xk0A== X-Forwarded-Encrypted: i=1; AL+hErEB0FgO+eMH3VpP2bBoWQo3+28f+sYHbfApPrpx6Ca8El1LTdA4x5EjXmk3RIrmS0rokjWkLgKl8ztuzQ==@vger.kernel.org X-Gm-Message-State: AB4q+uHO6Pje9nBMPCnSlNrp2/wPbN01ZxiiLXxmD/2M5gsobjGzYwPc mwRSljazZ9K5I3IBLGjAl6+vESYxz89og+GNQ1/U4eDElz7iOTBdWoXO X-Gm-Gg: AZFdTZdrKJhjmgH8W5MH/iLYi0t+B2ug8esOyW5OvGVBTD+a3X1SilcMvlAfaUzCs36 OUUtSW9gFaK9Qj/d+PwGImSdLjMFIlxa6ctpAMaod0c3FloOhu7mgrlZN8MCpiHIQMeTy06Fw0E Bfc162EzF2GHGDQRbbHdpHbS0jrjaW6cAnPR+idRSlEruTNgnewx9YO4IBOmS3bAolo+AQjKma0 NkkRx9efKPjFSiy75abrDIIJ+UcnP75cHm0BwqN/ZLwi5N+yNg1LddMxbxuYo1lXUf+Rp/M4SA2 w7zFvt6T6MzaYK1nFBbxqGlP63yscgLkUjobZSEdf1j7CgM/oehnPuNK4zD43DxlFoPC/2Rez9s 6eI4lteq+v6/WA4uG9Oi00wOkEegEzMoTwilCTqJVWSKQEe8qpIb6qlB/VR6AhEzrsdRTOxkQLM 0NWQCzRroFNuuLw2G1WVuLZZP5wobzCZNt5spuVZiYw4+D60vZMsl3eaxK2zKDmWYZTz22U8ZG6 wjORgvLfPIydcD0Ml19i4fH1lG7jGLbZdfO5ArWdcP6NsnS3L7g67UIVl7gzSib9+IQBG73xFJJ 6qWJZAQtV3OfSAI6KNR5HzS6NQ== X-Received: by 2002:a05:6000:2b89:b0:4b3:71c7:42bb with SMTP id ffacd0b85a97d-4d1e8dbce66mr9927899f8f.19.1796567387740; Sun, 06 Dec 2026 06:29:47 -0800 (PST) Received: from localhost ([2001:b07:5d26:7a6a:365a:60ff:fe0d:cfc6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d174d08d42sm16730155f8f.55.2026.12.06.06.29.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 06 Dec 2026 06:29:46 -0800 (PST) X-Mailing-List: linux-btrfs@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=c4d8628c26869009fce83ea5a937ac2036bfc2afb8a38f520889e6215919; micalg=pgp-sha512; protocol="application/pgp-signature" Date: Sun, 06 Dec 2026 15:29:45 +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 05/12] fs: add initial implementation of xflags masks to fileattr API From: "koraynilay" To: "Amir Goldstein" , "koraynilay" X-Mailer: aerc 0.22.0-0-gc2f86b7abde3 References: <20261205142411.164484-1-koray.fra@gmail.com> <20261205142411.164484-6-koray.fra@gmail.com> In-Reply-To: --c4d8628c26869009fce83ea5a937ac2036bfc2afb8a38f520889e6215919 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Sun Dec 6, 2026 at 3:12 PM CET, Amir Goldstein wrote: > On Sun, Dec 6, 2026 at 3:05=E2=80=AFPM koraynilay w= rote: >> >> On Sun Dec 6, 2026 at 2:22 PM CET, Amir Goldstein wrote: >> > On Sat, Dec 5, 2026 at 3:24=E2=80=AFPM koraynilay wrote: >> >> >> > >> > fs: add initial implementation of xflags masks to fileattr API >> > >> > "initial implementation" is too vague, this patch implements >> > the vfs parts of the fileattr mask api so just say so >> > >> >> Add read-write and read-only masks to the fileattr API to let >> > >> > to the vfs fileattr API, to avoid ambiguity >> > >> >> filesystems advertise their support for specific xflags, like >> >> statx.stx_attributes_mask, and to let userspace specify only which >> >> xflags it wants to change without needing a RMW cycle. >> >> >> >> The masks have the following semantics: >> >> - read-write mask: >> >> * for filesystems: advertise which xflags they support changing >> >> * for userspace: specify which xflags it wants to modify >> >> - read-only mask: >> >> * for filesystems: advertise which xflags they support only reading >> >> * for userspace: ignored >> >> >> >> And they should be filled according to the following: >> >> - GET: >> >> each filesystem that wants to implement this new API fills the mask= s >> >> according to its supported read-write and read-only xflags, >> >> then: >> >> * for boolean xflags: it fills fsx_xflags with the current on-disk = value; >> >> * for value xflags: it sets the xflag bit to 1 in fsx_xflags and th= e >> >> xflag value in the struct field; >> >> - SET: >> >> userspace fills the rw_mask with the bits of the xflags it wants to >> >> change, then: >> >> * for boolean xflags: it provides the xflag value as a bit in fsx_x= flags; >> >> * for value xflags: it sets the xflag bit to 1 in fsx_xflags and th= en >> >> provides the value in the struct field; if the xflag bit is set t= o 0 >> >> instead and the value is 0, this informs the kernel to unset/clea= r >> >> that value (if the value field is non-zero it should get rejected >> >> with -EINVAL). >> >> >> >> To achieve this, add fsx_xflags_{rw,ro}_mask fields and {has,use}_mas= ks >> >> selectors to struct file_kattr, so we can know when a user of this AP= I >> >> (userspace or filesystem) supports them. >> >> >> >> To eventually make both non-masks and masks programs interact correct= ly >> >> with both non-masks and masks filesystems, add: >> >> - fileattr_set_{from,to}_masks(): convert between non-masks >> >> read-modify-write API and masks API; >> >> - fileattr_set_convert(): handles calling the above helpers as needed= , >> >> then calls fileattr_set_preserve() if neither userspace nor filesys= tem >> >> has masks. >> >> >> >> Note that this is only the initial internal VFS implementation: it >> > >> > Drop "initial" >> > >> >> doesn't include any changes to UAPI yet, nor does it include >> >> FS_XFLAG_PROJID, so with only this patch it's not possible to set the >> >> project ID using masks. >> > >> > odd remark - user cannot set anything with masks yet. >> >> Should I remove this paragraph altogether or change it to something like >> "Since we have no FS_XFLAG_PROJID yet, return changing it as >> unsupported"? (or something else?) >> > > I think removing it is fine. I don't see what value it adds. Ok, I thought I had to say something about PROJID since it gets rejected in this patch (because of course we don't have the flag yet). I initially just wanted to remove the projid handling from this patch without adding any special cases, but the bot advised on handling it anyway (hence the return -EOPNOTSUPP for projid in set_to_masks()), which makese sense so the code is "complete". Thanks, koraynilay > Thanks, > Amir. --c4d8628c26869009fce83ea5a937ac2036bfc2afb8a38f520889e6215919 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHQEABYKAB0WIQSgVimKafU5DQMcjcDmj22qf5IGXAUCaxVxWQAKCRDmj22qf5IG XIYRAPj4jdlzT0jhLD+BT+G8B7JkX+pVADnt5oyqPca426upAP9o86oMjkW/zkYm /OI7aMHZdMOrRwWq+YEKKY6s+s/LAw== =vUK6 -----END PGP SIGNATURE----- --c4d8628c26869009fce83ea5a937ac2036bfc2afb8a38f520889e6215919--