Skip to content

Commit ce49bfc

Browse files
committed
Merge tag 'xfs-5.16-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs cleanups from Darrick Wong: "The most 'exciting' aspect of this branch is that the xfsprogs maintainer and I have worked through the last of the code discrepancies between kernel and userspace libxfs such that there are no code differences between the two except for #includes. IOWs, diff suffices to demonstrate that the userspace tools behave the same as the kernel, and kernel-only bits are clearly marked in the /kernel/ source code instead of just the userspace source. Summary: - Clean up open-coded swap() calls. - A little bit of #ifdef golf to complete the reunification of the kernel and userspace libxfs source code" * tag 'xfs-5.16-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: sync xfs_btree_split macros with userspace libxfs xfs: #ifdef out perag code for userspace xfs: use swap() to make dabtree code cleaner
2 parents c3b68c2 + 4a6b35b commit ce49bfc

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

fs/xfs/libxfs/xfs_ag.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ xfs_initialize_perag(
248248
spin_unlock(&mp->m_perag_lock);
249249
radix_tree_preload_end();
250250

251+
#ifdef __KERNEL__
251252
/* Place kernel structure only init below this point. */
252253
spin_lock_init(&pag->pag_ici_lock);
253254
spin_lock_init(&pag->pagb_lock);
@@ -257,6 +258,7 @@ xfs_initialize_perag(
257258
init_waitqueue_head(&pag->pagb_wait);
258259
pag->pagb_count = 0;
259260
pag->pagb_tree = RB_ROOT;
261+
#endif /* __KERNEL__ */
260262

261263
error = xfs_buf_hash_init(pag);
262264
if (error)

fs/xfs/libxfs/xfs_ag.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ struct xfs_perag {
6464
/* Blocks reserved for the reverse mapping btree. */
6565
struct xfs_ag_resv pag_rmapbt_resv;
6666

67+
/* for rcu-safe freeing */
68+
struct rcu_head rcu_head;
69+
70+
#ifdef __KERNEL__
6771
/* -- kernel only structures below this line -- */
6872

6973
/*
@@ -90,9 +94,6 @@ struct xfs_perag {
9094
spinlock_t pag_buf_lock; /* lock for pag_buf_hash */
9195
struct rhashtable pag_buf_hash;
9296

93-
/* for rcu-safe freeing */
94-
struct rcu_head rcu_head;
95-
9697
/* background prealloc block trimming */
9798
struct delayed_work pag_blockgc_work;
9899

@@ -102,6 +103,7 @@ struct xfs_perag {
102103
* or have some other means to control concurrency.
103104
*/
104105
struct rhashtable pagi_unlinked_hash;
106+
#endif /* __KERNEL__ */
105107
};
106108

107109
int xfs_initialize_perag(struct xfs_mount *mp, xfs_agnumber_t agcount,

fs/xfs/libxfs/xfs_btree.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2785,6 +2785,7 @@ __xfs_btree_split(
27852785
return error;
27862786
}
27872787

2788+
#ifdef __KERNEL__
27882789
struct xfs_btree_split_args {
27892790
struct xfs_btree_cur *cur;
27902791
int level;
@@ -2870,6 +2871,9 @@ xfs_btree_split(
28702871
destroy_work_on_stack(&args.work);
28712872
return args.result;
28722873
}
2874+
#else
2875+
#define xfs_btree_split __xfs_btree_split
2876+
#endif /* __KERNEL__ */
28732877

28742878

28752879
/*

fs/xfs/libxfs/xfs_da_btree.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,6 @@ xfs_da3_node_rebalance(
864864
{
865865
struct xfs_da_intnode *node1;
866866
struct xfs_da_intnode *node2;
867-
struct xfs_da_intnode *tmpnode;
868867
struct xfs_da_node_entry *btree1;
869868
struct xfs_da_node_entry *btree2;
870869
struct xfs_da_node_entry *btree_s;
@@ -894,9 +893,7 @@ xfs_da3_node_rebalance(
894893
((be32_to_cpu(btree2[0].hashval) < be32_to_cpu(btree1[0].hashval)) ||
895894
(be32_to_cpu(btree2[nodehdr2.count - 1].hashval) <
896895
be32_to_cpu(btree1[nodehdr1.count - 1].hashval)))) {
897-
tmpnode = node1;
898-
node1 = node2;
899-
node2 = tmpnode;
896+
swap(node1, node2);
900897
xfs_da3_node_hdr_from_disk(dp->i_mount, &nodehdr1, node1);
901898
xfs_da3_node_hdr_from_disk(dp->i_mount, &nodehdr2, node2);
902899
btree1 = nodehdr1.btree;

0 commit comments

Comments
 (0)