All of lore.kernel.org
 help / color / mirror / Atom feed
From: xiakaixu1987@gmail.com
To: linux-xfs@vger.kernel.org
Cc: darrick.wong@oracle.com, Kaixu Xia <kaixuxia@tencent.com>
Subject: [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local}
Date: Thu, 17 Sep 2020 19:38:47 +0800	[thread overview]
Message-ID: <1600342728-21149-7-git-send-email-kaixuxia@tencent.com> (raw)
In-Reply-To: <1600342728-21149-1-git-send-email-kaixuxia@tencent.com>

From: Kaixu Xia <kaixuxia@tencent.com>

Cleanup the typedef usage, the unnecessary parentheses, the unnecessary
backslash and use the open-coded round_up call in
xfs_attr_leaf_entsize_{remote,local}.

Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
 fs/xfs/libxfs/xfs_da_format.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h
index b40a4e80f5ee..09f0f5d42728 100644
--- a/fs/xfs/libxfs/xfs_da_format.h
+++ b/fs/xfs/libxfs/xfs_da_format.h
@@ -746,14 +746,14 @@ xfs_attr3_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
  */
 static inline int xfs_attr_leaf_entsize_remote(int nlen)
 {
-	return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \
-		XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
+	return round_up(sizeof(struct xfs_attr_leaf_name_remote) - 1 + nlen,
+			XFS_ATTR_LEAF_NAME_ALIGN);
 }
 
 static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen)
 {
-	return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) +
-		XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
+	return round_up(sizeof(struct xfs_attr_leaf_name_local) - 1 + nlen + vlen,
+			XFS_ATTR_LEAF_NAME_ALIGN);
 }
 
 static inline int xfs_attr_leaf_entsize_local_max(int bsize)
-- 
2.20.0


  parent reply	other threads:[~2020-09-17 11:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 11:38 [PATCH v2 0/7] xfs: random fixes and code cleanup xiakaixu1987
2020-09-17 11:38 ` [PATCH v2 1/7] xfs: remove the unused SYNCHRONIZE macro xiakaixu1987
2020-09-17 11:38 ` [PATCH v2 2/7] xfs: use the existing type definition for di_projid xiakaixu1987
2020-09-17 11:38 ` [PATCH v2 3/7] xfs: remove the unnecessary xfs_dqid_t type cast xiakaixu1987
2020-09-17 11:38 ` [PATCH v2 4/7] xfs: do the assert for all the log done items in xfs_trans_cancel xiakaixu1987
2020-09-17 18:18   ` Darrick J. Wong
2020-09-19  6:27   ` Christoph Hellwig
2020-09-23  3:26     ` kaixuxia
2020-09-17 11:38 ` [PATCH v2 5/7] xfs: remove the redundant crc feature check in xfs_attr3_rmt_verify xiakaixu1987
2020-09-17 18:18   ` Darrick J. Wong
2020-09-19  6:27   ` Christoph Hellwig
2020-09-19  6:28   ` Christoph Hellwig
2020-09-17 11:38 ` xiakaixu1987 [this message]
2020-09-17 18:19   ` [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local} Darrick J. Wong
2020-09-19  6:29   ` Christoph Hellwig
2020-09-23  3:21     ` kaixuxia
2020-09-17 11:38 ` [PATCH v2 7/7] xfs: fix some comments xiakaixu1987
2020-09-19  6:30   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1600342728-21149-7-git-send-email-kaixuxia@tencent.com \
    --to=xiakaixu1987@gmail.com \
    --cc=darrick.wong@oracle.com \
    --cc=kaixuxia@tencent.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.