* [PATCH v2 0/7] xfs: random fixes and code cleanup
@ 2020-09-17 11:38 xiakaixu1987
2020-09-17 11:38 ` [PATCH v2 1/7] xfs: remove the unused SYNCHRONIZE macro xiakaixu1987
` (6 more replies)
0 siblings, 7 replies; 18+ messages in thread
From: xiakaixu1987 @ 2020-09-17 11:38 UTC (permalink / raw)
To: linux-xfs; +Cc: darrick.wong, Kaixu Xia
From: Kaixu Xia <kaixuxia@tencent.com>
Hi all,
This patchset include random fixes and code cleanups, and there are no
connections among these patches. In order to make it easier to track,
I bundle them up and put all the scattered patches into a single patchset.
Changes for v2:
-detect intent-done items by their item ops.
-update the commit messages.
-code cleanup for xfs_attr_leaf_entsize_{remote,local}.
Kaixu Xia (7):
xfs: remove the unused SYNCHRONIZE macro
xfs: use the existing type definition for di_projid
xfs: remove the unnecessary xfs_dqid_t type cast
xfs: do the assert for all the log done items in xfs_trans_cancel
xfs: remove the redundant crc feature check in xfs_attr3_rmt_verify
xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local}
xfs: fix some comments
fs/xfs/libxfs/xfs_attr_remote.c | 2 --
fs/xfs/libxfs/xfs_da_format.h | 12 ++++++------
fs/xfs/libxfs/xfs_inode_buf.h | 2 +-
fs/xfs/xfs_dquot.c | 4 ++--
fs/xfs/xfs_linux.h | 1 -
fs/xfs/xfs_qm.c | 2 +-
fs/xfs/xfs_trans.c | 9 ++++++++-
7 files changed, 18 insertions(+), 14 deletions(-)
--
2.20.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v2 1/7] xfs: remove the unused SYNCHRONIZE macro
2020-09-17 11:38 [PATCH v2 0/7] xfs: random fixes and code cleanup xiakaixu1987
@ 2020-09-17 11:38 ` xiakaixu1987
2020-09-17 11:38 ` [PATCH v2 2/7] xfs: use the existing type definition for di_projid xiakaixu1987
` (5 subsequent siblings)
6 siblings, 0 replies; 18+ messages in thread
From: xiakaixu1987 @ 2020-09-17 11:38 UTC (permalink / raw)
To: linux-xfs; +Cc: darrick.wong, Kaixu Xia
From: Kaixu Xia <kaixuxia@tencent.com>
There are no callers of the SYNCHRONIZE() macro, so remove it.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_linux.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index ab737fed7b12..ad1009778d33 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -123,7 +123,6 @@ typedef __u32 xfs_nlink_t;
#define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
#define EFSBADCRC EBADMSG /* Bad CRC detected */
-#define SYNCHRONIZE() barrier()
#define __return_address __builtin_return_address(0)
/*
--
2.20.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 2/7] xfs: use the existing type definition for di_projid
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 ` xiakaixu1987
2020-09-17 11:38 ` [PATCH v2 3/7] xfs: remove the unnecessary xfs_dqid_t type cast xiakaixu1987
` (4 subsequent siblings)
6 siblings, 0 replies; 18+ messages in thread
From: xiakaixu1987 @ 2020-09-17 11:38 UTC (permalink / raw)
To: linux-xfs; +Cc: darrick.wong, Kaixu Xia
From: Kaixu Xia <kaixuxia@tencent.com>
We have already defined the project ID type prid_t, so maybe should
use it here.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/libxfs/xfs_inode_buf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/libxfs/xfs_inode_buf.h b/fs/xfs/libxfs/xfs_inode_buf.h
index 536666143fe7..ef5eaf33d146 100644
--- a/fs/xfs/libxfs/xfs_inode_buf.h
+++ b/fs/xfs/libxfs/xfs_inode_buf.h
@@ -17,7 +17,7 @@ struct xfs_dinode;
*/
struct xfs_icdinode {
uint16_t di_flushiter; /* incremented on flush */
- uint32_t di_projid; /* owner's project id */
+ prid_t di_projid; /* owner's project id */
xfs_fsize_t di_size; /* number of bytes in file */
xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */
xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
--
2.20.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 3/7] xfs: remove the unnecessary xfs_dqid_t type cast
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 ` 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
` (3 subsequent siblings)
6 siblings, 0 replies; 18+ messages in thread
From: xiakaixu1987 @ 2020-09-17 11:38 UTC (permalink / raw)
To: linux-xfs; +Cc: darrick.wong, Kaixu Xia
From: Kaixu Xia <kaixuxia@tencent.com>
Since the type prid_t and xfs_dqid_t both are uint32_t, seems the
type cast is unnecessary, so remove it.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_qm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 3f82e0c92c2d..41a459ffd1f2 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -1715,7 +1715,7 @@ xfs_qm_vop_dqalloc(
if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) {
if (ip->i_d.di_projid != prid) {
xfs_iunlock(ip, lockflags);
- error = xfs_qm_dqget(mp, (xfs_dqid_t)prid,
+ error = xfs_qm_dqget(mp, prid,
XFS_DQTYPE_PROJ, true, &pq);
if (error) {
ASSERT(error != -ENOENT);
--
2.20.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 4/7] xfs: do the assert for all the log done items in xfs_trans_cancel
2020-09-17 11:38 [PATCH v2 0/7] xfs: random fixes and code cleanup xiakaixu1987
` (2 preceding siblings ...)
2020-09-17 11:38 ` [PATCH v2 3/7] xfs: remove the unnecessary xfs_dqid_t type cast xiakaixu1987
@ 2020-09-17 11:38 ` xiakaixu1987
2020-09-17 18:18 ` Darrick J. Wong
2020-09-19 6:27 ` Christoph Hellwig
2020-09-17 11:38 ` [PATCH v2 5/7] xfs: remove the redundant crc feature check in xfs_attr3_rmt_verify xiakaixu1987
` (2 subsequent siblings)
6 siblings, 2 replies; 18+ messages in thread
From: xiakaixu1987 @ 2020-09-17 11:38 UTC (permalink / raw)
To: linux-xfs; +Cc: darrick.wong, Kaixu Xia
From: Kaixu Xia <kaixuxia@tencent.com>
We should do the assert for all the log intent-done items if they appear
here. This patch detect intent-done items by the fact that their item ops
don't have iop_unpin and iop_push methods.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
fs/xfs/xfs_trans.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index ca18a040336a..0d5d5a53fa5a 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -925,6 +925,13 @@ xfs_trans_commit(
return __xfs_trans_commit(tp, false);
}
+/* Is this a log intent-done item? */
+static inline bool xlog_item_is_intent_done(struct xfs_log_item *lip)
+{
+ return lip->li_ops->iop_unpin == NULL &&
+ lip->li_ops->iop_push == NULL;
+}
+
/*
* Unlock all of the transaction's items and free the transaction.
* The transaction must not have modified any of its items, because
@@ -959,7 +966,7 @@ xfs_trans_cancel(
struct xfs_log_item *lip;
list_for_each_entry(lip, &tp->t_items, li_trans)
- ASSERT(!(lip->li_type == XFS_LI_EFD));
+ ASSERT(!xlog_item_is_intent_done(lip));
}
#endif
xfs_trans_unreserve_and_mod_sb(tp);
--
2.20.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 5/7] xfs: remove the redundant crc feature check in xfs_attr3_rmt_verify
2020-09-17 11:38 [PATCH v2 0/7] xfs: random fixes and code cleanup xiakaixu1987
` (3 preceding siblings ...)
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 11:38 ` xiakaixu1987
2020-09-17 18:18 ` Darrick J. Wong
` (2 more replies)
2020-09-17 11:38 ` [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local} xiakaixu1987
2020-09-17 11:38 ` [PATCH v2 7/7] xfs: fix some comments xiakaixu1987
6 siblings, 3 replies; 18+ messages in thread
From: xiakaixu1987 @ 2020-09-17 11:38 UTC (permalink / raw)
To: linux-xfs; +Cc: darrick.wong, Kaixu Xia
From: Kaixu Xia <kaixuxia@tencent.com>
We already check whether the crc feature is enabled before calling
xfs_attr3_rmt_verify(), so remove the redundant feature check in that
function.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
fs/xfs/libxfs/xfs_attr_remote.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index 3f80cede7406..48d8e9caf86f 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -96,8 +96,6 @@ xfs_attr3_rmt_verify(
{
struct xfs_attr3_rmt_hdr *rmt = ptr;
- if (!xfs_sb_version_hascrc(&mp->m_sb))
- return __this_address;
if (!xfs_verify_magic(bp, rmt->rm_magic))
return __this_address;
if (!uuid_equal(&rmt->rm_uuid, &mp->m_sb.sb_meta_uuid))
--
2.20.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local}
2020-09-17 11:38 [PATCH v2 0/7] xfs: random fixes and code cleanup xiakaixu1987
` (4 preceding siblings ...)
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 11:38 ` xiakaixu1987
2020-09-17 18:19 ` Darrick J. Wong
2020-09-19 6:29 ` Christoph Hellwig
2020-09-17 11:38 ` [PATCH v2 7/7] xfs: fix some comments xiakaixu1987
6 siblings, 2 replies; 18+ messages in thread
From: xiakaixu1987 @ 2020-09-17 11:38 UTC (permalink / raw)
To: linux-xfs; +Cc: darrick.wong, Kaixu Xia
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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 7/7] xfs: fix some comments
2020-09-17 11:38 [PATCH v2 0/7] xfs: random fixes and code cleanup xiakaixu1987
` (5 preceding siblings ...)
2020-09-17 11:38 ` [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local} xiakaixu1987
@ 2020-09-17 11:38 ` xiakaixu1987
2020-09-19 6:30 ` Christoph Hellwig
6 siblings, 1 reply; 18+ messages in thread
From: xiakaixu1987 @ 2020-09-17 11:38 UTC (permalink / raw)
To: linux-xfs; +Cc: darrick.wong, Kaixu Xia
From: Kaixu Xia <kaixuxia@tencent.com>
Fix the comments to help people understand the code.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/libxfs/xfs_da_format.h | 4 ++--
fs/xfs/xfs_dquot.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h
index 09f0f5d42728..2a72f1760169 100644
--- a/fs/xfs/libxfs/xfs_da_format.h
+++ b/fs/xfs/libxfs/xfs_da_format.h
@@ -35,8 +35,8 @@ typedef struct xfs_da_blkinfo {
*/
#define XFS_DA3_NODE_MAGIC 0x3ebe /* magic number: non-leaf blocks */
#define XFS_ATTR3_LEAF_MAGIC 0x3bee /* magic number: attribute leaf blks */
-#define XFS_DIR3_LEAF1_MAGIC 0x3df1 /* magic number: v2 dirlf single blks */
-#define XFS_DIR3_LEAFN_MAGIC 0x3dff /* magic number: v2 dirlf multi blks */
+#define XFS_DIR3_LEAF1_MAGIC 0x3df1 /* magic number: v3 dirlf single blks */
+#define XFS_DIR3_LEAFN_MAGIC 0x3dff /* magic number: v3 dirlf multi blks */
struct xfs_da3_blkinfo {
/*
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 3072814e407d..1d95ed387d66 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -831,8 +831,8 @@ xfs_qm_dqget_checks(
}
/*
- * Given the file system, id, and type (UDQUOT/GDQUOT), return a locked
- * dquot, doing an allocation (if requested) as needed.
+ * Given the file system, id, and type (UDQUOT/GDQUOT/PDQUOT), return a
+ * locked dquot, doing an allocation (if requested) as needed.
*/
int
xfs_qm_dqget(
--
2.20.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v2 4/7] xfs: do the assert for all the log done items in xfs_trans_cancel
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
1 sibling, 0 replies; 18+ messages in thread
From: Darrick J. Wong @ 2020-09-17 18:18 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, Kaixu Xia
On Thu, Sep 17, 2020 at 07:38:45PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> We should do the assert for all the log intent-done items if they appear
> here. This patch detect intent-done items by the fact that their item ops
> don't have iop_unpin and iop_push methods.
>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Seems ok to me,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> fs/xfs/xfs_trans.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index ca18a040336a..0d5d5a53fa5a 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -925,6 +925,13 @@ xfs_trans_commit(
> return __xfs_trans_commit(tp, false);
> }
>
> +/* Is this a log intent-done item? */
> +static inline bool xlog_item_is_intent_done(struct xfs_log_item *lip)
> +{
> + return lip->li_ops->iop_unpin == NULL &&
> + lip->li_ops->iop_push == NULL;
> +}
> +
> /*
> * Unlock all of the transaction's items and free the transaction.
> * The transaction must not have modified any of its items, because
> @@ -959,7 +966,7 @@ xfs_trans_cancel(
> struct xfs_log_item *lip;
>
> list_for_each_entry(lip, &tp->t_items, li_trans)
> - ASSERT(!(lip->li_type == XFS_LI_EFD));
> + ASSERT(!xlog_item_is_intent_done(lip));
> }
> #endif
> xfs_trans_unreserve_and_mod_sb(tp);
> --
> 2.20.0
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 5/7] xfs: remove the redundant crc feature check in xfs_attr3_rmt_verify
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
2 siblings, 0 replies; 18+ messages in thread
From: Darrick J. Wong @ 2020-09-17 18:18 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, Kaixu Xia
On Thu, Sep 17, 2020 at 07:38:46PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> We already check whether the crc feature is enabled before calling
> xfs_attr3_rmt_verify(), so remove the redundant feature check in that
> function.
>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Looks good,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> fs/xfs/libxfs/xfs_attr_remote.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
> index 3f80cede7406..48d8e9caf86f 100644
> --- a/fs/xfs/libxfs/xfs_attr_remote.c
> +++ b/fs/xfs/libxfs/xfs_attr_remote.c
> @@ -96,8 +96,6 @@ xfs_attr3_rmt_verify(
> {
> struct xfs_attr3_rmt_hdr *rmt = ptr;
>
> - if (!xfs_sb_version_hascrc(&mp->m_sb))
> - return __this_address;
> if (!xfs_verify_magic(bp, rmt->rm_magic))
> return __this_address;
> if (!uuid_equal(&rmt->rm_uuid, &mp->m_sb.sb_meta_uuid))
> --
> 2.20.0
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local}
2020-09-17 11:38 ` [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local} xiakaixu1987
@ 2020-09-17 18:19 ` Darrick J. Wong
2020-09-19 6:29 ` Christoph Hellwig
1 sibling, 0 replies; 18+ messages in thread
From: Darrick J. Wong @ 2020-09-17 18:19 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, Kaixu Xia
On Thu, Sep 17, 2020 at 07:38:47PM +0800, xiakaixu1987@gmail.com wrote:
> 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>
Seems alright,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> 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
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 4/7] xfs: do the assert for all the log done items in xfs_trans_cancel
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
1 sibling, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2020-09-19 6:27 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, darrick.wong, Kaixu Xia
On Thu, Sep 17, 2020 at 07:38:45PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> We should do the assert for all the log intent-done items if they appear
> here. This patch detect intent-done items by the fact that their item ops
> don't have iop_unpin and iop_push methods.
>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
> ---
> fs/xfs/xfs_trans.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index ca18a040336a..0d5d5a53fa5a 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -925,6 +925,13 @@ xfs_trans_commit(
> return __xfs_trans_commit(tp, false);
> }
>
> +/* Is this a log intent-done item? */
> +static inline bool xlog_item_is_intent_done(struct xfs_log_item *lip)
> +{
> + return lip->li_ops->iop_unpin == NULL &&
> + lip->li_ops->iop_push == NULL;
> +}
I think this helper should go into xfs_trans.h, next to the
xfs_log_item log item definition. And xlog_item_is_intent should
be moved there as well.
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 5/7] xfs: remove the redundant crc feature check in xfs_attr3_rmt_verify
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
2 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2020-09-19 6:27 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, darrick.wong, Kaixu Xia
On Thu, Sep 17, 2020 at 07:38:46PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> We already check whether the crc feature is enabled before calling
> xfs_attr3_rmt_verify(), so remove the redundant feature check in that
> function.
>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 5/7] xfs: remove the redundant crc feature check in xfs_attr3_rmt_verify
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
2 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2020-09-19 6:28 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, darrick.wong, Kaixu Xia
On Thu, Sep 17, 2020 at 07:38:46PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> We already check whether the crc feature is enabled before calling
> xfs_attr3_rmt_verify(), so remove the redundant feature check in that
> function.
>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local}
2020-09-17 11:38 ` [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local} xiakaixu1987
2020-09-17 18:19 ` Darrick J. Wong
@ 2020-09-19 6:29 ` Christoph Hellwig
2020-09-23 3:21 ` kaixuxia
1 sibling, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2020-09-19 6:29 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, darrick.wong, Kaixu Xia
On Thu, Sep 17, 2020 at 07:38:47PM +0800, xiakaixu1987@gmail.com wrote:
> 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,
Please avoid the overly long line here.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 7/7] xfs: fix some comments
2020-09-17 11:38 ` [PATCH v2 7/7] xfs: fix some comments xiakaixu1987
@ 2020-09-19 6:30 ` Christoph Hellwig
0 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2020-09-19 6:30 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, darrick.wong, Kaixu Xia
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local}
2020-09-19 6:29 ` Christoph Hellwig
@ 2020-09-23 3:21 ` kaixuxia
0 siblings, 0 replies; 18+ messages in thread
From: kaixuxia @ 2020-09-23 3:21 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs, darrick.wong, Kaixu Xia
On 2020/9/19 14:29, Christoph Hellwig wrote:
> On Thu, Sep 17, 2020 at 07:38:47PM +0800, xiakaixu1987@gmail.com wrote:
>> 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,
>
> Please avoid the overly long line here.
Okay, will fix it in the next version.
Thanks,
Kaixu
>
--
kaixuxia
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 4/7] xfs: do the assert for all the log done items in xfs_trans_cancel
2020-09-19 6:27 ` Christoph Hellwig
@ 2020-09-23 3:26 ` kaixuxia
0 siblings, 0 replies; 18+ messages in thread
From: kaixuxia @ 2020-09-23 3:26 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs, darrick.wong, Kaixu Xia
On 2020/9/19 14:27, Christoph Hellwig wrote:
> On Thu, Sep 17, 2020 at 07:38:45PM +0800, xiakaixu1987@gmail.com wrote:
>> From: Kaixu Xia <kaixuxia@tencent.com>
>>
>> We should do the assert for all the log intent-done items if they appear
>> here. This patch detect intent-done items by the fact that their item ops
>> don't have iop_unpin and iop_push methods.
>>
>> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
>> ---
>> fs/xfs/xfs_trans.c | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
>> index ca18a040336a..0d5d5a53fa5a 100644
>> --- a/fs/xfs/xfs_trans.c
>> +++ b/fs/xfs/xfs_trans.c
>> @@ -925,6 +925,13 @@ xfs_trans_commit(
>> return __xfs_trans_commit(tp, false);
>> }
>>
>> +/* Is this a log intent-done item? */
>> +static inline bool xlog_item_is_intent_done(struct xfs_log_item *lip)
>> +{
>> + return lip->li_ops->iop_unpin == NULL &&
>> + lip->li_ops->iop_push == NULL;
>> +}
>
> I think this helper should go into xfs_trans.h, next to the
> xfs_log_item log item definition. And xlog_item_is_intent should
> be moved there as well.
>
Yeah,make more sense, will move them to xfs_trans.h in the next version.
Thanks,
Kaixu
> Otherwise looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
--
kaixuxia
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2020-09-23 3:26 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v2 6/7] xfs: code cleanup in xfs_attr_leaf_entsize_{remote,local} xiakaixu1987
2020-09-17 18:19 ` 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
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.