From patchwork Sat Mar 2 07:41:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 1907085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=T6o04TDQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=gandalf.ozlabs.org; envelope-from=srs0=ofo6=ki=vger.kernel.org=linux-ext4+bounces-1466-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tmxl63Xzsz1yYg for ; Sat, 2 Mar 2024 18:42:58 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Tmxl633TDz4wcb for ; Sat, 2 Mar 2024 18:42:58 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Tmxl62zVtz4wxx; Sat, 2 Mar 2024 18:42:58 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=T6o04TDQ; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-ext4+bounces-1466-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4Tmxl56qJzz4wcb for ; Sat, 2 Mar 2024 18:42:57 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2B7EA1C219E2 for ; Sat, 2 Mar 2024 07:42:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00E0414284; Sat, 2 Mar 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T6o04TDQ" X-Original-To: linux-ext4@vger.kernel.org Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54BA313FF1; Sat, 2 Mar 2024 07:42:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709365352; cv=none; b=kCBqBlLHI4JChR8JiGHAx8ycZcUoDqbAUVnpGd2OxCnfcGGJ28gjXJfJLV/M2qPWBrwzlqphIs85IUelWCkxb0Tantyl8S/f5B5feLuojPTMGWo17eydBbeTHgUHJLBTc3LzDe+0TOKJSYkRU7VjLsXIAYEnTdh2dSkRxR/S29Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709365352; c=relaxed/simple; bh=Lxf86wsgMeVIjl0s92RhlwZEQt9iGDE8hAGXnMOeIA8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q83OcIPnqGv/InsR75FQx5S0Cd+7i96QrYaqKdROUJx0DVtdaH04rPO8B7TeONE1NLn49RvP9KHUOV3quljhTAuf932BRFb0FUKpyTGcf2MQ5+LI82RCuqFgVBPayP63hSmKDs3+mNUNd/W/LA8KUAcb6ALTyu5CtavUR0y6iNs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T6o04TDQ; arc=none smtp.client-ip=209.85.160.51 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 Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-214def5da12so1575020fac.2; Fri, 01 Mar 2024 23:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709365349; x=1709970149; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oUtRlA4LTpnrKeik+etCM2Hf0A7iESJvM3SgKuLTazM=; b=T6o04TDQfLvmXf/8g0jijtB7KlwW3OmkCac/MdAoxuqnRgKVnq43r9+hbyVrcpvMkz mJjdp1jzYGwCW4YHjtl+grWJyM2Tf1VsnOA8G7RksT879D+xaB56m0iNhitvZYH4xPTf mCOcobto02pHFdOs6kxqDE0P5GielGFJDxD2qaj715ToBF/bBBJtZUemG47V4gxlzE8b HaQ2VgNK40TvD42gfbjfAgv0C9cVlBeX2SpJQtWlu9GCPVwluAUeyubwLei/jWzt7E22 dHSUu6T6e0tDKc/YT8Rli781UFKcodUtx5F9YKc1fYBmtGtXoQJ+UlFfhwRFSAehpgAA Cxcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709365349; x=1709970149; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oUtRlA4LTpnrKeik+etCM2Hf0A7iESJvM3SgKuLTazM=; b=amnoNPFnEQYafUQTRb1rJLnaI3ubzsp9PjCdC31SMr022GBkEhS8IWOPgsTwcCLZNk MVTeKlDRiShv7tv9oU9i1Y4+knWUX/0tvpo/V3JtKBw34VMMyMJyvQri6krlUEU38a7U cpm6F0zuDjFDvv+/Hd5ng6HiywUdX+Qnzy1ckwuuuZ/xpcHfZdgD3kiPq6EOylmbhMSu seOwSg4z7JOLcSAU0PzUPcR7aOKXuj/ppgU6nG3rmuErhMuD1ZsXgmvtfBnv2cJN7CSX OM9PUleYO2+iH4hGvQJes9secC1taqbjOsX/NCgfJ76Vy65UwQ+EPytKVCa+k3two9a0 SwRQ== X-Forwarded-Encrypted: i=1; AJvYcCWCRWb6S2mgBYzYKx7RB/RleTs7eFC0iM+OOtXB9J7EXmT5d5pUTzoN+4qBeEEwJhcUsEAKSVCuygS6aerwB4i1m2gB4eI4rcSu3o+Uow7PzgAki23Vx1NwRtCBMDROtitRNDe7TrUhPw== X-Gm-Message-State: AOJu0YzyVmsjBpj1lXvC0Ki8IC0QEfoRu2cYsB/zMyEkjiXivb4cP72+ 927ykD+sCoiaHSN8EuPYlyLhw3L33Pga0jjU9RqkfCbNn3B/xYTdy6ve/6Ss X-Google-Smtp-Source: AGHT+IFLWQMIWT3GGADxP32VJxgTJ7bnzRo5oiL+zKPMncJknrpocXur9iaOqh9flLW96BfDePoPcA== X-Received: by 2002:a05:6870:230b:b0:21e:d763:f5f1 with SMTP id w11-20020a056870230b00b0021ed763f5f1mr4114232oao.42.1709365348656; Fri, 01 Mar 2024 23:42:28 -0800 (PST) Received: from dw-tp.. ([49.205.218.89]) by smtp.gmail.com with ESMTPSA id x11-20020aa784cb000000b006e45c5d7720sm4138206pfn.93.2024.03.01.23.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 23:42:28 -0800 (PST) From: "Ritesh Harjani (IBM)" To: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: Ojaswin Mujoo , Jan Kara , Theodore Ts'o , Matthew Wilcox , "Darrick J . Wong" , Luis Chamberlain , John Garry , linux-kernel@vger.kernel.org, Ritesh Harjani Subject: [RFC 1/8] fs: Add FS_XFLAG_ATOMICWRITES flag Date: Sat, 2 Mar 2024 13:11:58 +0530 Message-ID: <555cc3e262efa77ee5648196362f415a1efc018d.1709361537.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: John Garry Add a flag indicating that a regular file is enabled for atomic writes. Signed-off-by: John Garry Signed-off-by: Ritesh Harjani (IBM) --- include/uapi/linux/fs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index a0975ae81e64..b5b4e1db9576 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -140,6 +140,7 @@ struct fsxattr { #define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */ #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */ #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */ +#define FS_XFLAG_ATOMICWRITES 0x00020000 /* atomic writes enabled */ #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ /* the read-only stuff doesn't really belong here, but any other place is From patchwork Sat Mar 2 07:42:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 1907102 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=fm123pWv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=s5pz=ki=vger.kernel.org=linux-ext4+bounces-1474-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TmxpM0Qy0z23l2 for ; Sat, 2 Mar 2024 18:45:47 +1100 (AEDT) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4TmxpL748vz4wbr for ; Sat, 2 Mar 2024 18:45:46 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4TmxpL70F5z4wyh; Sat, 2 Mar 2024 18:45:46 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=fm123pWv; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-ext4+bounces-1474-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4TmxpL4g9Cz4wbr for ; Sat, 2 Mar 2024 18:45:46 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3DEA228370F for ; Sat, 2 Mar 2024 07:45:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7DC314293; Sat, 2 Mar 2024 07:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fm123pWv" X-Original-To: linux-ext4@vger.kernel.org Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10A3B24A0E; Sat, 2 Mar 2024 07:43:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709365382; cv=none; b=Sl1EU2gNlYpVyZ4vv98ffrFr1xrbhqkp5SP5sDjIAWZX8lMvtDZ9drRgslnKL1dV02rBjWDpQmmB9hKAPjmwkUopHopRm2fvxRNQYQsnC5cJAhRUtBvqbqZTabdXcgC2shDuDKuRKdLvUL11tXzuLoIzvz3Zjr1Q5+zvOg8N/H0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709365382; c=relaxed/simple; bh=4GgXxZs/mglWIRYd9/bl71jA6REtfHyAlcztG0gdRX8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CudLb6oUBEuYQ+8IoXDgfdMs4qGYUgKR+IixDJQyEZ4d9HIgaIl/fRzIp3D+pngXwQkdxW2JA/Gk/CxLZ9eZus+SxM5v+Q0Eup/qAVgqKxlTK9oSn30kpcw1Mr+EybkW73tWvtiM0JocFCUnlCtYyRO6WBOdHqR1wBB/LcILUYY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fm123pWv; arc=none smtp.client-ip=209.85.210.178 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 Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6e5d7f1f15bso863636b3a.2; Fri, 01 Mar 2024 23:43:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709365379; x=1709970179; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iROnnUQAIrn8DnCE9YGkqkSmP3qnk0ncEloJYBFiPVY=; b=fm123pWvIxbYCJCah26aQGuboZ93+hVunMqnSIXQ4lr3fLAEi6Yn+uKS64CA80Z/dO PoBV0+p088i8HXpKkKMWoA04fTRYDMivD8n+U7VeMCJj0vTIBg4540Nxz3tBjf7amHlQ bOeOudMdAbGR92DdyVf+KhRXetd2yULG5rIRYfovLLemSgYrxxoiL1XpDQMaXZbUa9pT Mh8Iq1MMkYU9tSsPVzjw5o5lLzVIWmDVhMWY1OVxk39FGnwA4+NwwkYk6fDcEnUjqovW 88ZBbGJmP+YDBcSSWqxA2Vl3eVUYniLJAMt552l93nAuwBVot/C5GTxEpjquvBc+41jn 6LZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709365379; x=1709970179; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iROnnUQAIrn8DnCE9YGkqkSmP3qnk0ncEloJYBFiPVY=; b=V8XgKrkDOpE7qP8xwGrQortvzhIj/QMeCBP3cq2HI0WXm+2URaeeSR+D2h2QXHOwPd ngP65cpSWfTKpLn8F11gVWdTbVKEKjNXQFghYLIO3J7mOrmMAvIS9ZxXby1gYWn2e+w4 CmjKk9yoApZLI0mDbKnuPcygOiOUpAQR6e3no8MKnj7EaHyT4P0MfO6Rk2N9fWOAEgKj hC3MR5bAgJTU5ZxmpercpbherJFyYD4v7doGJbePwIjhGsajPjjrWjHWJilm/tx/DCuK U07kcmWFrWXVPKyWujvQ4CBUVTIxiB2EVDSgzO7WAbPEsWVdNdjMP1tMzH1En4WOiIi0 eOkQ== X-Forwarded-Encrypted: i=1; AJvYcCVl1Ncu8T9rDMt7mqpgGvUf9DjWSi1tI1g+wSSEiNfaNZiyhVSdGRAWG2NoD/WcD9UkdWU3PnhbxVXPf/Q2sZ8m3Mvbpee2tCzJEkhpM56U5oOTL2yscaswgFZawX2OvivcZRJvtjH+vw== X-Gm-Message-State: AOJu0YzS74zH2fqTuR5WGeM2i7p+bAisXjOjENEowzQoL6vj09+pXCir znGXN59lK89zyUadzIM276PMCjxmoK0ADuif4Gygl0rP0cBZLPlaa9dBQ1K4 X-Google-Smtp-Source: AGHT+IFPpIE1yMNr/ZCVoN5pvHpYmcwWC5rH1/HSKdLic7af17QTNikWfEa+xeGlN1Lyzwgs/tWXjA== X-Received: by 2002:a05:6a00:852:b0:6e5:736e:cc8 with SMTP id q18-20020a056a00085200b006e5736e0cc8mr4513372pfk.33.1709365379431; Fri, 01 Mar 2024 23:42:59 -0800 (PST) Received: from dw-tp.. ([49.205.218.89]) by smtp.gmail.com with ESMTPSA id x11-20020aa784cb000000b006e45c5d7720sm4138206pfn.93.2024.03.01.23.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 23:42:58 -0800 (PST) From: "Ritesh Harjani (IBM)" To: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: Ojaswin Mujoo , Jan Kara , Theodore Ts'o , Matthew Wilcox , "Darrick J . Wong" , Luis Chamberlain , John Garry , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" Subject: [RFC 9/9] e2fsprogs/chattr: Supports atomic writes attribute Date: Sat, 2 Mar 2024 13:12:06 +0530 Message-ID: <646de2f0f9ba8fb8a486dc388ae0748999d1ed2d.1709356319.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This adds 'W' which is atomic write attribute to chattr. Signed-off-by: Ritesh Harjani (IBM) --- lib/e2p/pf.c | 1 + lib/ext2fs/ext2_fs.h | 2 +- misc/chattr.1.in | 18 ++++++++++++++---- misc/chattr.c | 3 ++- 4 files changed, 18 insertions(+), 6 deletions(-) -- 2.39.2 diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c index 81e3bb26..9b311477 100644 --- a/lib/e2p/pf.c +++ b/lib/e2p/pf.c @@ -45,6 +45,7 @@ static struct flags_name flags_array[] = { { EXT4_EXTENTS_FL, "e", "Extents" }, { FS_NOCOW_FL, "C", "No_COW" }, { FS_DAX_FL, "x", "DAX" }, + { FS_ATOMICWRITES_FL, "W", "ATOMIC_WRITES" }, { 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 0fc9c09a..f9dcf71f 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -346,7 +346,7 @@ struct ext2_dx_tail { #define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */ /* 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_ATOMICWRITES_FL 0x01000000 /* Inode can do atomic writes */ #define FS_DAX_FL 0x02000000 /* Inode is DAX */ #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */ #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */ diff --git a/misc/chattr.1.in b/misc/chattr.1.in index 50c54e7d..22757123 100644 --- a/misc/chattr.1.in +++ b/misc/chattr.1.in @@ -26,7 +26,7 @@ changes the file attributes on a Linux file system. The format of a symbolic .I mode is -.BR +-= [ aAcCdDeFijmPsStTux ]. +.BR +-= [ aAcCdDeFijmPsStTuxW ]. .PP The operator .RB ' + ' @@ -38,7 +38,7 @@ causes them to be removed; and causes them to be the only attributes that the files have. .PP The letters -.RB ' aAcCdDeFijmPsStTux ' +.RB ' aAcCdDeFijmPsStTuxW ' select the new attributes for the files: append only .RB ( a ), @@ -74,8 +74,10 @@ top of directory hierarchy .RB ( T ), undeletable .RB ( u ), -and direct access for files -.RB ( x ). +direct access for files +.RB ( x ), +and atomic writes for files. +.RB ( W ). .PP The following attributes are read-only, and may be listed by .BR lsattr (1) @@ -263,6 +265,14 @@ 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 W +The 'W' attribute can only be set on a regular file. A file which has this +attribute set can do untorn writes i.e. if an atomic write is requested by +user with proper alignment and atomic flags set (such as RWF_ATOMIC), then +a subsequent read to that block(s) will either read entire new data or entire +old data (in case of a power failure). The block(s) written can never contain +mix of both. +.TP .B V A file with the 'V' attribute set has fs-verity enabled. It cannot be written to, and the file system will automatically verify all data read diff --git a/misc/chattr.c b/misc/chattr.c index c7382a37..24db790e 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 [-RVf] [-+=aAcCdDeijPsStTuFx] [-p project] [-v version] files...\n"), + _("Usage: %s [-RVf] [-+=aAcCdDeijPsStTuFxW] [-p project] [-v version] files...\n"), program_name); exit(1); } @@ -114,6 +114,7 @@ static const struct flags_char flags_array[] = { { EXT2_TOPDIR_FL, 'T' }, { FS_NOCOW_FL, 'C' }, { FS_DAX_FL, 'x' }, + { FS_ATOMICWRITES_FL, 'W' }, { EXT4_CASEFOLD_FL, 'F' }, { 0, 0 } };