]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs: remove unused buffer tracing code
authorDave Chinner <dchinner@redhat.com>
Fri, 20 Nov 2020 22:03:30 +0000 (17:03 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 20 Nov 2020 22:03:30 +0000 (17:03 -0500)
This isn't particularly useful for finding issues, it's rarely used
and complicates the conversion to the kernel buffer cache code. THe
kernel code also carries it's own trace hooks that could be
implemented if tracing is needed, so remove this code to make the
conversion simpler.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/libxfs_io.h
libxfs/rdwr.c

index e7ec754f6b86ddcb3e6874ed934d2a33ffdf3984..9e65f4a63bfb0662e5d0f4b64f8ed191695b38b9 100644 (file)
@@ -80,12 +80,6 @@ typedef struct xfs_buf {
        struct xfs_buf_map      __b_map;
        int                     b_nmaps;
        struct list_head        b_list;
-#ifdef XFS_BUF_TRACING
-       struct list_head        b_lock_list;
-       const char              *b_func;
-       const char              *b_file;
-       int                     b_line;
-#endif
 } xfs_buf_t;
 
 bool xfs_verify_magic(struct xfs_buf *bp, __be32 dmagic);
@@ -129,47 +123,6 @@ extern struct cache_operations     libxfs_bcache_operations;
 /* Return the buffer even if the verifiers fail. */
 #define LIBXFS_READBUF_SALVAGE         (1 << 1)
 
-#ifdef XFS_BUF_TRACING
-
-#define libxfs_buf_read(dev, daddr, len, flags, bpp, ops) \
-       libxfs_trace_readbuf(__FUNCTION__, __FILE__, __LINE__, \
-                           (dev), (daddr), (len), (flags), (bpp), (ops))
-#define libxfs_buf_read_map(dev, map, nmaps, flags, bpp, ops) \
-       libxfs_trace_readbuf_map(__FUNCTION__, __FILE__, __LINE__, \
-                           (dev), (map), (nmaps), (flags), (bpp), (ops))
-#define libxfs_buf_mark_dirty(buf) \
-       libxfs_trace_dirtybuf(__FUNCTION__, __FILE__, __LINE__, \
-                             (buf))
-#define libxfs_buf_get(dev, daddr, len, bpp) \
-       libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \
-                           (dev), (daddr), (len), (bpp))
-#define libxfs_buf_get_map(dev, map, nmaps, flags, bpp) \
-       libxfs_trace_getbuf_map(__FUNCTION__, __FILE__, __LINE__, \
-                           (dev), (map), (nmaps), (flags), (bpp))
-#define libxfs_buf_relse(buf) \
-       libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf))
-
-int libxfs_trace_readbuf(const char *func, const char *file, int line,
-                       struct xfs_buftarg *btp, xfs_daddr_t daddr, size_t len,
-                       int flags, const struct xfs_buf_ops *ops,
-                       struct xfs_buf **bpp);
-int libxfs_trace_readbuf_map(const char *func, const char *file, int line,
-                       struct xfs_buftarg *btp, struct xfs_buf_map *maps,
-                       int nmaps, int flags, struct xfs_buf **bpp,
-                       const struct xfs_buf_ops *ops);
-void libxfs_trace_dirtybuf(const char *func, const char *file, int line,
-                       struct xfs_buf *bp);
-int libxfs_trace_getbuf(const char *func, const char *file, int line,
-                       struct xfs_buftarg *btp, xfs_daddr_t daddr,
-                       size_t len, struct xfs_buf **bpp);
-int libxfs_trace_getbuf_map(const char *func, const char *file, int line,
-                       struct xfs_buftarg *btp, struct xfs_buf_map *map,
-                       int nmaps, int flags, struct xfs_buf **bpp);
-extern void    libxfs_trace_putbuf (const char *, const char *, int,
-                       xfs_buf_t *);
-
-#else
-
 int libxfs_buf_read_map(struct xfs_buftarg *btp, struct xfs_buf_map *maps,
                        int nmaps, int flags, struct xfs_buf **bpp,
                        const struct xfs_buf_ops *ops);
@@ -204,8 +157,6 @@ libxfs_buf_read(
        return libxfs_buf_read_map(target, &map, 1, flags, bpp, ops);
 }
 
-#endif /* XFS_BUF_TRACING */
-
 int libxfs_readbuf_verify(struct xfs_buf *bp, const struct xfs_buf_ops *ops);
 struct xfs_buf *libxfs_getsb(struct xfs_mount *mp);
 extern void    libxfs_bcache_purge(void);
index 0001a459aa649534c9ef4246ba5e199a323e6a63..0ce3da46b6da668b7362a7b3d74f6a76bd468b41 100644 (file)
@@ -147,133 +147,6 @@ static char *next(
        return ptr + offset;
 }
 
-/*
- * Simple I/O (buffer cache) interface
- */
-
-
-#ifdef XFS_BUF_TRACING
-
-#undef libxfs_buf_read_map
-#undef libxfs_writebuf
-#undef libxfs_buf_get_map
-
-int            libxfs_buf_read_map(struct xfs_buftarg *btp,
-                               struct xfs_buf_map *maps, int nmaps, int flags,
-                               struct xfs_buf **bpp,
-                               const struct xfs_buf_ops *ops);
-int            libxfs_writebuf(xfs_buf_t *, int);
-int            libxfs_buf_get_map(struct xfs_buftarg *btp,
-                               struct xfs_buf_map *maps, int nmaps, int flags,
-                               struct xfs_buf **bpp);
-void           libxfs_buf_relse(struct xfs_buf *bp);
-
-#define        __add_trace(bp, func, file, line)       \
-do {                                           \
-       if (bp) {                               \
-               (bp)->b_func = (func);          \
-               (bp)->b_file = (file);          \
-               (bp)->b_line = (line);          \
-       }                                       \
-} while (0)
-
-int
-libxfs_trace_readbuf(
-       const char              *func,
-       const char              *file,
-       int                     line,
-       struct xfs_buftarg      *btp,
-       xfs_daddr_t             blkno,
-       size_t                  len,
-       int                     flags,
-       const struct xfs_buf_ops *ops,
-       struct xfs_buf          **bpp)
-{
-       int                     error;
-       DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
-
-       error = libxfs_buf_read_map(btp, &map, 1, flags, bpp, ops);
-       __add_trace(*bpp, func, file, line);
-       return error;
-}
-
-int
-libxfs_trace_readbuf_map(
-       const char              *func,
-       const char              *file,
-       int                     line,
-       struct xfs_buftarg      *btp,
-       struct xfs_buf_map      *map,
-       int                     nmaps,
-       int                     flags,
-       struct xfs_buf          **bpp,
-       const struct xfs_buf_ops *ops)
-{
-       int                     error;
-
-       error = libxfs_buf_read_map(btp, map, nmaps, flags, bpp, ops);
-       __add_trace(*bpp, func, file, line);
-       return error;
-}
-
-void
-libxfs_trace_dirtybuf(
-       const char              *func,
-       const char              *file,
-       int                     line,
-       struct xfs_buf          *bp)
-{
-       __add_trace(bp, func, file, line);
-       libxfs_buf_mark_dirty(bp);
-}
-
-int
-libxfs_trace_getbuf(
-       const char              *func,
-       const char              *file,
-       int                     line,
-       struct xfs_buftarg      *btp,
-       xfs_daddr_t             blkno,
-       size_t                  len,
-       struct xfs_buf          **bpp)
-{
-       int                     error;
-       DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
-
-       error = libxfs_buf_get_map(target, &map, 1, 0, bpp);
-       __add_trace(bp, func, file, line);
-       return error;
-}
-
-int
-libxfs_trace_getbuf_map(
-       const char              *func,
-       const char              *file,
-       int                     line,
-       struct xfs_buftarg      *btp,
-       struct xfs_buf_map      *map,
-       int                     nmaps,
-       int                     flags,
-       struct xfs_buf          **bpp)
-{
-       int                     error;
-
-       error = libxfs_buf_get_map(btp, map, nmaps, flags, bpp);
-       __add_trace(*bpp, func, file, line);
-       return error;
-}
-
-void
-libxfs_trace_putbuf(const char *func, const char *file, int line, xfs_buf_t *bp)
-{
-       __add_trace(bp, func, file, line);
-       libxfs_buf_relse(bp);
-}
-
-
-#endif
-
-
 struct xfs_buf *
 libxfs_getsb(
        struct xfs_mount        *mp)
@@ -369,9 +242,6 @@ __initbuf(xfs_buf_t *bp, struct xfs_buftarg *btp, xfs_daddr_t bno,
                exit(1);
        }
        memset(bp->b_addr, 0, bytes);
-#ifdef XFS_BUF_TRACING
-       list_head_init(&bp->b_lock_list);
-#endif
        pthread_mutex_init(&bp->b_lock, NULL);
        bp->b_holder = 0;
        bp->b_recur = 0;
@@ -513,11 +383,6 @@ libxfs_getbufr_map(struct xfs_buftarg *btp, xfs_daddr_t blkno, int bblen,
        return bp;
 }
 
-#ifdef XFS_BUF_TRACING
-struct list_head       lock_buf_list = {&lock_buf_list, &lock_buf_list};
-int                    lock_buf_count = 0;
-#endif
-
 static int
 __cache_lookup(
        struct xfs_bufkey       *key,
@@ -562,12 +427,6 @@ __cache_lookup(
 
        cache_node_set_priority(libxfs_bcache, cn,
                        cache_node_get_priority(cn) - CACHE_PREFETCH_PRIORITY);
-#ifdef XFS_BUF_TRACING
-       pthread_mutex_lock(&libxfs_bcache->c_mutex);
-       lock_buf_count++;
-       list_add(&bp->b_lock_list, &lock_buf_list);
-       pthread_mutex_unlock(&libxfs_bcache->c_mutex);
-#endif
 #ifdef IO_DEBUG
        printf("%lx %s: hit buffer %p for bno = 0x%llx/0x%llx\n",
                pthread_self(), __FUNCTION__,
@@ -678,14 +537,6 @@ libxfs_buf_relse(
         * over to the next user.
         */
        bp->b_error = 0;
-
-#ifdef XFS_BUF_TRACING
-       pthread_mutex_lock(&libxfs_bcache->c_mutex);
-       lock_buf_count--;
-       ASSERT(lock_buf_count >= 0);
-       list_del_init(&bp->b_lock_list);
-       pthread_mutex_unlock(&libxfs_bcache->c_mutex);
-#endif
        if (use_xfs_buf_lock) {
                if (bp->b_recur) {
                        bp->b_recur--;