Skip to content

Commit

Permalink
xfs: #ifdef out perag code for userspace
Browse files Browse the repository at this point in the history
The xfs_perag structure and initialization is unused in userspace,
so #ifdef it out with __KERNEL__ to facilitate the xfsprogs sync
and build.

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
  • Loading branch information
Eric Sandeen authored and Darrick J. Wong committed Nov 10, 2021
1 parent 5b068aa commit 29f11fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions fs/xfs/libxfs/xfs_ag.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ xfs_initialize_perag(
spin_unlock(&mp->m_perag_lock);
radix_tree_preload_end();

#ifdef __KERNEL__
/* Place kernel structure only init below this point. */
spin_lock_init(&pag->pag_ici_lock);
spin_lock_init(&pag->pagb_lock);
Expand All @@ -257,6 +258,7 @@ xfs_initialize_perag(
init_waitqueue_head(&pag->pagb_wait);
pag->pagb_count = 0;
pag->pagb_tree = RB_ROOT;
#endif /* __KERNEL__ */

error = xfs_buf_hash_init(pag);
if (error)
Expand Down
8 changes: 5 additions & 3 deletions fs/xfs/libxfs/xfs_ag.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ struct xfs_perag {
/* Blocks reserved for the reverse mapping btree. */
struct xfs_ag_resv pag_rmapbt_resv;

/* for rcu-safe freeing */
struct rcu_head rcu_head;

#ifdef __KERNEL__
/* -- kernel only structures below this line -- */

/*
Expand All @@ -90,9 +94,6 @@ struct xfs_perag {
spinlock_t pag_buf_lock; /* lock for pag_buf_hash */
struct rhashtable pag_buf_hash;

/* for rcu-safe freeing */
struct rcu_head rcu_head;

/* background prealloc block trimming */
struct delayed_work pag_blockgc_work;

Expand All @@ -102,6 +103,7 @@ struct xfs_perag {
* or have some other means to control concurrency.
*/
struct rhashtable pagi_unlinked_hash;
#endif /* __KERNEL__ */
};

int xfs_initialize_perag(struct xfs_mount *mp, xfs_agnumber_t agcount,
Expand Down

0 comments on commit 29f11fc

Please sign in to comment.