From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BD87C6FD1F for ; Thu, 16 Mar 2023 19:23:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230235AbjCPTXq (ORCPT ); Thu, 16 Mar 2023 15:23:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjCPTXo (ORCPT ); Thu, 16 Mar 2023 15:23:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B336CB044 for ; Thu, 16 Mar 2023 12:23:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DD677B82324 for ; Thu, 16 Mar 2023 19:23:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F965C433D2; Thu, 16 Mar 2023 19:23:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678994583; bh=QcuOJkzezOh+vG1fDOVTAItvGHtpVkMesxJAVAHYpcE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Ai8csVEC2n1FASMrkqlSL6PyoTybhJe4px50z5Eb48mItaYQoRbT4VzCfy35BTne+ WSKONs8/s5C2Z2mL0kJ6L0DhtL6zCqzvukNRak1lLZ+hARGXGia9hKUKU4hyUzZh+m cNhNNn4vK04uXVAORF8t2UsNUvWiT3Eu5T+MUufIyRUEkPJv+xULTmhdkMr7HRCIkG CDzuhXTVW0LwAqpo7KKWjfuXGkHPi7li9HT8itMR7w4LYCRmudOoY5n/YSnJJzkfzq 1zI8yArKXhpFihhPU97IsOkhn6PTr9fYJLMir38Xl3OxIoOF3afgiAKGPZabiz/LPR 3b7ACiPGNUHJw== Date: Thu, 16 Mar 2023 12:23:03 -0700 Subject: [PATCH 06/17] xfs: use helpers to extract xattr op from opflags From: "Darrick J. Wong" To: djwong@kernel.org Cc: allison.henderson@oracle.com, linux-xfs@vger.kernel.org Message-ID: <167899414441.15363.8535090970060717992.stgit@frogsfrogsfrogs> In-Reply-To: <167899414339.15363.12404998880107296432.stgit@frogsfrogsfrogs> References: <167899414339.15363.12404998880107296432.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Create helper functions to extract the xattr op from the ondisk xattri log item and the incore attr intent item. These will get more use in the patches that follow. Signed-off-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.h | 5 +++++ fs/xfs/xfs_attr_item.c | 18 +++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 02a20b948c8f..0185d29d5109 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -530,6 +530,11 @@ struct xfs_attr_intent { struct xfs_bmbt_irec xattri_map; }; +static inline unsigned int +xfs_attr_intent_op(const struct xfs_attr_intent *attr) +{ + return attr->xattri_op_flags & XFS_ATTRI_OP_FLAGS_TYPE_MASK; +} /*======================================================================== * Function prototypes for the kernel. diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index dac5d9cfc804..f4b5777445e1 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -374,6 +374,12 @@ xfs_xattri_finish_update( return error; } +static inline unsigned int +xfs_attr_log_item_op(const struct xfs_attri_log_format *attrp) +{ + return attrp->alfi_op_flags & XFS_ATTRI_OP_FLAGS_TYPE_MASK; +} + /* Log an attr to the intent item. */ STATIC void xfs_attr_log_item( @@ -525,10 +531,9 @@ xfs_attri_validate( struct xfs_mount *mp, struct xfs_attri_log_format *attrp) { - unsigned int op = attrp->alfi_op_flags & - XFS_ATTRI_OP_FLAGS_TYPE_MASK; + unsigned int op = xfs_attr_log_item_op(attrp); - if (attrp->alfi_op_flags != XFS_ATTRI_OP_FLAGS_NVREPLACE && + if (op != XFS_ATTRI_OP_FLAGS_NVREPLACE && attrp->alfi_nname_len != 0) return false; @@ -606,8 +611,7 @@ xfs_attri_item_recover( args = (struct xfs_da_args *)(attr + 1); attr->xattri_da_args = args; - attr->xattri_op_flags = attrp->alfi_op_flags & - XFS_ATTRI_OP_FLAGS_TYPE_MASK; + attr->xattri_op_flags = xfs_attr_log_item_op(attrp); /* * We're reconstructing the deferred work state structure from the @@ -631,7 +635,7 @@ xfs_attri_item_recover( ASSERT(xfs_sb_version_haslogxattrs(&mp->m_sb)); - switch (attr->xattri_op_flags) { + switch (xfs_attr_intent_op(attr)) { case XFS_ATTRI_OP_FLAGS_SET: case XFS_ATTRI_OP_FLAGS_REPLACE: case XFS_ATTRI_OP_FLAGS_NVREPLACE: @@ -765,7 +769,7 @@ xlog_recover_attri_commit_pass2( return -EFSCORRUPTED; } - op = attri_formatp->alfi_op_flags & XFS_ATTRI_OP_FLAGS_TYPE_MASK; + op = xfs_attr_log_item_op(attri_formatp); switch (op) { case XFS_ATTRI_OP_FLAGS_SET: case XFS_ATTRI_OP_FLAGS_REPLACE: