xfs: rename xfs_wait_buftarg() to xfs_buftarg_drain()
authorBrian Foster <bfoster@redhat.com>
Sat, 23 Jan 2021 00:48:19 +0000 (16:48 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Sat, 23 Jan 2021 00:54:50 +0000 (16:54 -0800)
xfs_wait_buftarg() is vaguely named and somewhat overloaded. Its
primary purpose is to reclaim all buffers from the provided buffer
target LRU. In preparation to refactor xfs_wait_buftarg() into
serialization and LRU draining components, rename the function and
associated helpers to something more descriptive. This patch has no
functional changes with the minor exception of renaming a
tracepoint.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/xfs_buf.c
fs/xfs/xfs_buf.h
fs/xfs/xfs_log.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_trace.h

index f8400bbd64730b1957a6cebb61886835b47d1505..99ee8b0f499c6a734d217897ae350bd29a48d967 100644 (file)
@@ -43,7 +43,7 @@ static kmem_zone_t *xfs_buf_zone;
  *       pag_buf_lock
  *         lru_lock
  *
- * xfs_buftarg_wait_rele
+ * xfs_buftarg_drain_rele
  *     lru_lock
  *       b_lock (trylock due to inversion)
  *
@@ -88,7 +88,7 @@ xfs_buf_vmap_len(
  * because the corresponding decrement is deferred to buffer release. Buffers
  * can undergo I/O multiple times in a hold-release cycle and per buffer I/O
  * tracking adds unnecessary overhead. This is used for sychronization purposes
- * with unmount (see xfs_wait_buftarg()), so all we really need is a count of
+ * with unmount (see xfs_buftarg_drain()), so all we really need is a count of
  * in-flight buffers.
  *
  * Buffers that are never released (e.g., superblock, iclog buffers) must set
@@ -1786,7 +1786,7 @@ __xfs_buf_mark_corrupt(
  * while freeing all the buffers only held by the LRU.
  */
 static enum lru_status
-xfs_buftarg_wait_rele(
+xfs_buftarg_drain_rele(
        struct list_head        *item,
        struct list_lru_one     *lru,
        spinlock_t              *lru_lock,
@@ -1798,7 +1798,7 @@ xfs_buftarg_wait_rele(
 
        if (atomic_read(&bp->b_hold) > 1) {
                /* need to wait, so skip it this pass */
-               trace_xfs_buf_wait_buftarg(bp, _RET_IP_);
+               trace_xfs_buf_drain_buftarg(bp, _RET_IP_);
                return LRU_SKIP;
        }
        if (!spin_trylock(&bp->b_lock))
@@ -1816,7 +1816,7 @@ xfs_buftarg_wait_rele(
 }
 
 void
-xfs_wait_buftarg(
+xfs_buftarg_drain(
        struct xfs_buftarg      *btp)
 {
        LIST_HEAD(dispose);
@@ -1841,7 +1841,7 @@ xfs_wait_buftarg(
 
        /* loop until there is nothing left on the lru list. */
        while (list_lru_count(&btp->bt_lru)) {
-               list_lru_walk(&btp->bt_lru, xfs_buftarg_wait_rele,
+               list_lru_walk(&btp->bt_lru, xfs_buftarg_drain_rele,
                              &dispose, LONG_MAX);
 
                while (!list_empty(&dispose)) {
index 5d91a31298a4bdde7cf05c8a969a987b741108d2..d5e31ba205e02195c15de4a9b135536feca3d255 100644 (file)
@@ -152,7 +152,7 @@ struct xfs_buf {
        struct list_head        b_list;
        struct xfs_perag        *b_pag;         /* contains rbtree root */
        struct xfs_mount        *b_mount;
-       xfs_buftarg_t           *b_target;      /* buffer target (device) */
+       struct xfs_buftarg      *b_target;      /* buffer target (device) */
        void                    *b_addr;        /* virtual address of buffer */
        struct work_struct      b_ioend_work;
        struct completion       b_iowait;       /* queue for I/O waiters */
@@ -344,11 +344,11 @@ xfs_buf_update_cksum(struct xfs_buf *bp, unsigned long cksum_offset)
 /*
  *     Handling of buftargs.
  */
-extern xfs_buftarg_t *xfs_alloc_buftarg(struct xfs_mount *,
-                       struct block_device *, struct dax_device *);
+extern struct xfs_buftarg *xfs_alloc_buftarg(struct xfs_mount *,
+               struct block_device *, struct dax_device *);
 extern void xfs_free_buftarg(struct xfs_buftarg *);
-extern void xfs_wait_buftarg(xfs_buftarg_t *);
-extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int);
+extern void xfs_buftarg_drain(struct xfs_buftarg *);
+extern int xfs_setsize_buftarg(struct xfs_buftarg *, unsigned int);
 
 #define xfs_getsize_buftarg(buftarg)   block_size((buftarg)->bt_bdev)
 #define xfs_readonly_buftarg(buftarg)  bdev_read_only((buftarg)->bt_bdev)
index fa2d05e65ff1fc00041b92c703635dc5804145f5..5ad4d5e780191d3f06c8079f347cad6564bf7be3 100644 (file)
@@ -741,7 +741,7 @@ xfs_log_mount_finish(
                xfs_log_force(mp, XFS_LOG_SYNC);
                xfs_ail_push_all_sync(mp->m_ail);
        }
-       xfs_wait_buftarg(mp->m_ddev_targp);
+       xfs_buftarg_drain(mp->m_ddev_targp);
 
        if (readonly)
                mp->m_flags |= XFS_MOUNT_RDONLY;
@@ -936,13 +936,13 @@ xfs_log_quiesce(
 
        /*
         * The superblock buffer is uncached and while xfs_ail_push_all_sync()
-        * will push it, xfs_wait_buftarg() will not wait for it. Further,
+        * will push it, xfs_buftarg_drain() will not wait for it. Further,
         * xfs_buf_iowait() cannot be used because it was pushed with the
         * XBF_ASYNC flag set, so we need to use a lock/unlock pair to wait for
         * the IO to complete.
         */
        xfs_ail_push_all_sync(mp->m_ail);
-       xfs_wait_buftarg(mp->m_ddev_targp);
+       xfs_buftarg_drain(mp->m_ddev_targp);
        xfs_buf_lock(mp->m_sb_bp);
        xfs_buf_unlock(mp->m_sb_bp);
 
index 7110507a2b6bc2ee0f8ee9be771895146e11471b..29a553f0877d75040c4dc8e556682ae8d164d38d 100644 (file)
@@ -1023,8 +1023,8 @@ xfs_mountfs(
        xfs_log_mount_cancel(mp);
  out_fail_wait:
        if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp)
-               xfs_wait_buftarg(mp->m_logdev_targp);
-       xfs_wait_buftarg(mp->m_ddev_targp);
+               xfs_buftarg_drain(mp->m_logdev_targp);
+       xfs_buftarg_drain(mp->m_ddev_targp);
  out_free_perag:
        xfs_free_perag(mp);
  out_free_dir:
index 5a263ae3d4f00890d6c67ed240d954afb9c36461..e2e0092c331df5c4df5cd392699354ce92e9120b 100644 (file)
@@ -358,7 +358,7 @@ DEFINE_BUF_EVENT(xfs_buf_get_uncached);
 DEFINE_BUF_EVENT(xfs_buf_item_relse);
 DEFINE_BUF_EVENT(xfs_buf_iodone_async);
 DEFINE_BUF_EVENT(xfs_buf_error_relse);
-DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
+DEFINE_BUF_EVENT(xfs_buf_drain_buftarg);
 DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
 
 /* not really buffer traces, but the buf provides useful information */