From patchwork Thu Dec 7 02:28:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13482598 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0F2015CE for ; Thu, 7 Dec 2023 02:28:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pfCWIHvV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF141C433C7; Thu, 7 Dec 2023 02:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701916113; bh=Dl099UIZycXgclKM0a4h4R7bw+ZUha2Pxd2L2oiOOd4=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=pfCWIHvVswhCfAGpxGDLXyBK201zkxgxw0gXkkb3rvmV9/QcR586oV0NiZnr7NuKt b4DkXTygfqojJX3RWJ8tsu2OC4krvzWLrf2hfXMsxQkHpsuTlZaCS2GdbepDDdDH6v c+pp0SDvkE7tttH/MvC6TXMsA697Yahpgxx5oC7ELnegt0D6WaZOYKlWaLmUvJl889 en9JNYB2L/+1oI+nidOnNADv738QqVJbxTH4e3J36pdi1i4WRqIcqFraIsLmkIJfdH YifR/zrRu71LIDV4Sgp8CbiNoXEeNysKkVJXXti4Z7TEWlw6W9Nf2t/svxK/0KXAIF FNq0fVC/80deg== Date: Wed, 06 Dec 2023 18:28:33 -0800 Subject: [PATCH 1/2] xfs: document what LARP means From: "Darrick J. Wong" To: chandanbabu@kernel.org, hch@lst.de, djwong@kernel.org Cc: linux-xfs@vger.kernel.org Message-ID: <170191563293.1133791.6107631178744558029.stgit@frogsfrogsfrogs> In-Reply-To: <170191563274.1133791.13463182603929465584.stgit@frogsfrogsfrogs> References: <170191563274.1133791.13463182603929465584.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Christoph requested a blurb somewhere explaining exactly what LARP means. I don't know of a good place other than the source code (debug knobs aren't covered in Documentation/), so here it is. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_sysfs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c index a3c6b1548723..871f16a4a5d8 100644 --- a/fs/xfs/xfs_sysfs.c +++ b/fs/xfs/xfs_sysfs.c @@ -229,6 +229,15 @@ pwork_threads_show( } XFS_SYSFS_ATTR_RW(pwork_threads); +/* + * The "LARP" (Logged extended Attribute Recovery Persistence) debugging knob + * sets the XFS_DA_OP_LOGGED flag on all xfs_attr_set operations performed on + * V5 filesystems. As a result, the intermediate progress of all setxattr and + * removexattr operations are tracked via the log and can be restarted during + * recovery. This is useful for testing xattr recovery prior to merging of the + * parent pointer feature which requires it to maintain consistency, and may be + * enabled for userspace xattrs in the future. + */ static ssize_t larp_store( struct kobject *kobject, From patchwork Thu Dec 7 02:28:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13482599 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 877BF1845 for ; Thu, 7 Dec 2023 02:28:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lhsrXKaq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58497C433C8; Thu, 7 Dec 2023 02:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701916129; bh=Bemw4zoL8SOlvH5z5OcigV7kHwIU9sbq8NnuAP0B2SA=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=lhsrXKaqScAM19juSmwTm4v8PbhcWn6aa5Y23JCvE+NaFZWa7ljX4RdgIkVsU1cFi ueGHhXr3GhdHuvFj9zjXEb+b8yHryCffFdRJ7bKWG+YQ6L+L7SIpFMmWT+MwHH9mLC YMqXMdXOqjoqXKRIZ64GoGv2PqnxxCr5q72MFT1r0c0ZYsNWm148myHGEj0l76l3x1 PeE9ExaHU1/J7p2rS4mzXMYaO8Ch1uUoNZykF4THSwzpoIi8F9TyVEEAC/m26Idyk5 w8rGURrKABMONrJJ8XeSx7TKkTMsjkG9wsCtGTcv0uGEv3fizkc9gtdIzIHiAOZMge mvOQmFFmxfg0g== Date: Wed, 06 Dec 2023 18:28:48 -0800 Subject: [PATCH 2/2] xfs: elide ->create_done calls for unlogged deferred work From: "Darrick J. Wong" To: chandanbabu@kernel.org, hch@lst.de, djwong@kernel.org Cc: linux-xfs@vger.kernel.org Message-ID: <170191563309.1133791.5522737407197572289.stgit@frogsfrogsfrogs> In-Reply-To: <170191563274.1133791.13463182603929465584.stgit@frogsfrogsfrogs> References: <170191563274.1133791.13463182603929465584.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Extended attribute updates use the deferred work machinery to manage state across a chain of smaller transactions. All previous deferred work users have employed log intent items and log done items to manage restarting of interrupted operations, which means that ->create_intent sets dfp_intent to a log intent item and ->create_done uses that item to create a log intent done item. However, xattrs have used the INCOMPLETE flag to deal with the lack of recovery support for an interrupted transaction chain. Log items are optional if the xattr update caller didn't set XFS_DA_OP_LOGGED to require a restartable sequence. In other words, ->create_intent can return NULL to say that there's no log intent item. If that's the case, no log intent done item should be created. Clean up xfs_defer_create_done not to do this, so that the ->create_done functions don't have to check for non-null dfp_intent themselves. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/libxfs/xfs_defer.c | 4 ++++ fs/xfs/xfs_attr_item.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index 54a6be06e6cd..06e890b44c52 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -201,6 +201,10 @@ xfs_defer_create_done( const struct xfs_defer_op_type *ops = defer_op_types[dfp->dfp_type]; struct xfs_log_item *lip; + /* If there is no log intent item, there can be no log done item. */ + if (!dfp->dfp_intent) + return; + /* * Mark the transaction dirty, even on error. This ensures the * transaction is aborted, which: diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 988d395a48ad..39f2c5a46179 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -740,9 +740,6 @@ xfs_attr_create_done( struct xfs_attri_log_item *attrip; struct xfs_attrd_log_item *attrdp; - if (!intent) - return NULL; - attrip = ATTRI_ITEM(intent); attrdp = kmem_cache_zalloc(xfs_attrd_cache, GFP_NOFS | __GFP_NOFAIL);