All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Dave Chinner <david@fromorbit.com>, sandeen@redhat.com
Cc: xfs <linux-xfs@vger.kernel.org>, "Darrick J. Wong" <djwong@kernel.org>
Subject: Re: [PATCH V3 RFC] xfsprogs: remove stubbed-out kernel functions out from xfs_shared.h
Date: Fri, 5 Nov 2021 11:40:57 -0500	[thread overview]
Message-ID: <0123f094-a073-0ba8-7cac-27394193d277@sandeen.net> (raw)
In-Reply-To: <20211104223823.GF449541@dread.disaster.area>

On 11/4/21 5:38 PM, Dave Chinner wrote:

> With those changes, we end up with some new stubs in libxfs_priv.h
> and two places where we need #ifdef __KERNEL__ in xfs_ag.[ch]. Most
> of the mess in this patch goes away....
> 
> Cheers,
> 
> Dave.
Ok.

I will split this up into the right patch granularity, but is this the
endpoint you're looking for?  One #ifdef in each of xfs_ag.[ch], two total.

The delayed work init/cancel assymmetry is a little odd, but I'll
get over it.

diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 15bae1ff..2ca3b9b2 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -673,6 +673,9 @@ static inline void xfs_iunlink_destroy(struct xfs_perag *pag) { }
  xfs_agnumber_t xfs_set_inode_alloc(struct xfs_mount *mp,
  		xfs_agnumber_t agcount);
  
+/* Faked up kernel bits */
+#define cancel_delayed_work_sync(work) do { } while(0)
+
  /* Keep static checkers quiet about nonstatic functions by exporting */
  int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp,
  		  xfs_rtblock_t block, int issum, struct xfs_buf **bpp);
diff --git a/libxfs/xfs_ag.c b/libxfs/xfs_ag.c
index 9eda6eba..149f9857 100644
--- a/libxfs/xfs_ag.c
+++ b/libxfs/xfs_ag.c
@@ -246,6 +246,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);
@@ -255,6 +256,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)
diff --git a/libxfs/xfs_ag.h b/libxfs/xfs_ag.h
index 4c6f9045..ef04a537 100644
--- a/libxfs/xfs_ag.h
+++ b/libxfs/xfs_ag.h
@@ -64,8 +64,11 @@ struct xfs_perag {
  	/* Blocks reserved for the reverse mapping btree. */
  	struct xfs_ag_resv	pag_rmapbt_resv;
  
-	/* -- kernel only structures below this line -- */
+	/* for rcu-safe freeing */
+	struct rcu_head	rcu_head;
  
+#ifdef __KERNEL__
+	/* -- kernel only structures below this line -- */
  	/*
  	 * Bitsets of per-ag metadata that have been checked and/or are sick.
  	 * Callers should hold pag_state_lock before accessing this field.
@@ -90,9 +93,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;
  
@@ -102,6 +102,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,
diff --git a/libxfs/xfs_shared.h b/libxfs/xfs_shared.h
index bafee48c..25c4cab5 100644
--- a/libxfs/xfs_shared.h
+++ b/libxfs/xfs_shared.h
@@ -180,24 +180,4 @@ struct xfs_ino_geometry {
  
  };
  
-/* Faked up kernel bits */
-struct rb_root {
-};
-
-#define RB_ROOT 		(struct rb_root) { }
-
-typedef struct wait_queue_head {
-} wait_queue_head_t;
-
-#define init_waitqueue_head(wqh)	do { } while(0)
-
-struct rhashtable {
-};
-
-struct delayed_work {
-};
-
-#define INIT_DELAYED_WORK(work, func)	do { } while(0)
-#define cancel_delayed_work_sync(work)	do { } while(0)
-
  #endif /* __XFS_SHARED_H__ */

  reply	other threads:[~2021-11-05 16:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04  2:21 [PATCH] xfsprogs: move stubbed-out kernel functions out of xfs_shared.h Eric Sandeen
2021-11-04  2:28 ` Darrick J. Wong
2021-11-04  2:55   ` Eric Sandeen
2021-11-04  2:59 ` [PATCH V2] " Eric Sandeen
2021-11-04  3:14   ` Darrick J. Wong
2021-11-04  3:33     ` Eric Sandeen
2021-11-04 17:15 ` [PATCH V3 RFC] xfsprogs: remove stubbed-out kernel functions out from xfs_shared.h Eric Sandeen
2021-11-04 19:08   ` Darrick J. Wong
2021-11-04 22:38   ` Dave Chinner
2021-11-05 16:40     ` Eric Sandeen [this message]
2021-11-07 22:58       ` Dave Chinner

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=0123f094-a073-0ba8-7cac-27394193d277@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /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.