[4/4] libxfs: remove libxfs_iomove
diff mbox series

Message ID 20200312141715.550387-5-hch@lst.de
State Accepted
Headers show
Series
  • [1/4] libxfs: turn the xfs_buf_incore stub into an inline function
Related show

Commit Message

Christoph Hellwig March 12, 2020, 2:17 p.m. UTC
This function has been removed in the kernel already.  Replace the only
user that want to zero buffers with a straight call to memset.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 libxfs/libxfs_io.h   |  6 ------
 libxfs/libxfs_priv.h |  5 ++---
 libxfs/rdwr.c        | 24 ------------------------
 3 files changed, 2 insertions(+), 33 deletions(-)

Comments

Darrick J. Wong March 12, 2020, 2:56 p.m. UTC | #1
On Thu, Mar 12, 2020 at 03:17:15PM +0100, Christoph Hellwig wrote:
> This function has been removed in the kernel already.  Replace the only
> user that want to zero buffers with a straight call to memset.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  libxfs/libxfs_io.h   |  6 ------
>  libxfs/libxfs_priv.h |  5 ++---
>  libxfs/rdwr.c        | 24 ------------------------
>  3 files changed, 2 insertions(+), 33 deletions(-)

woot,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> 
> diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
> index a0605882..0f682305 100644
> --- a/libxfs/libxfs_io.h
> +++ b/libxfs/libxfs_io.h
> @@ -213,12 +213,6 @@ extern int	libxfs_device_zero(struct xfs_buftarg *, xfs_daddr_t, uint);
>  
>  extern int libxfs_bhash_size;
>  
> -#define LIBXFS_BREAD	0x1
> -#define LIBXFS_BWRITE	0x2
> -#define LIBXFS_BZERO	0x4
> -
> -extern void	libxfs_iomove (xfs_buf_t *, uint, int, void *, int);
> -
>  static inline int
>  xfs_buf_verify_cksum(struct xfs_buf *bp, unsigned long cksum_offset)
>  {
> diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
> index d07d8f32..b5677a22 100644
> --- a/libxfs/libxfs_priv.h
> +++ b/libxfs/libxfs_priv.h
> @@ -374,9 +374,8 @@ static inline struct xfs_buf *xfs_buf_incore(struct xfs_buftarg *target,
>  	return NULL;
>  }
>  
> -#define XBRW_READ			LIBXFS_BREAD
> -#define XBRW_WRITE			LIBXFS_BWRITE
> -#define xfs_buf_zero(bp,off,len)     libxfs_iomove(bp,off,len,NULL,LIBXFS_BZERO)
> +#define xfs_buf_zero(bp, off, len) \
> +	memset((bp)->b_addr + off, 0, len);
>  
>  /* mount stuff */
>  #define XFS_MOUNT_32BITINODES		LIBXFS_MOUNT_32BITINODES
> diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
> index 7430ff09..6a9895f1 100644
> --- a/libxfs/rdwr.c
> +++ b/libxfs/rdwr.c
> @@ -1009,30 +1009,6 @@ libxfs_buf_mark_dirty(
>  	bp->b_flags |= LIBXFS_B_DIRTY;
>  }
>  
> -void
> -libxfs_iomove(xfs_buf_t *bp, uint boff, int len, void *data, int flags)
> -{
> -#ifdef IO_DEBUG
> -	if (boff + len > bp->b_bcount) {
> -		printf("Badness, iomove out of range!\n"
> -			"bp=(bno 0x%llx, bytes %u) range=(boff %u, bytes %u)\n",
> -			(long long)bp->b_bn, bp->b_bcount, boff, len);
> -		abort();
> -	}
> -#endif
> -	switch (flags) {
> -	case LIBXFS_BZERO:
> -		memset(bp->b_addr + boff, 0, len);
> -		break;
> -	case LIBXFS_BREAD:
> -		memcpy(data, bp->b_addr + boff, len);
> -		break;
> -	case LIBXFS_BWRITE:
> -		memcpy(bp->b_addr + boff, data, len);
> -		break;
> -	}
> -}
> -
>  /* Complain about (and remember) dropping dirty buffers. */
>  static void
>  libxfs_whine_dirty_buf(
> -- 
> 2.24.1
>

Patch
diff mbox series

diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
index a0605882..0f682305 100644
--- a/libxfs/libxfs_io.h
+++ b/libxfs/libxfs_io.h
@@ -213,12 +213,6 @@  extern int	libxfs_device_zero(struct xfs_buftarg *, xfs_daddr_t, uint);
 
 extern int libxfs_bhash_size;
 
-#define LIBXFS_BREAD	0x1
-#define LIBXFS_BWRITE	0x2
-#define LIBXFS_BZERO	0x4
-
-extern void	libxfs_iomove (xfs_buf_t *, uint, int, void *, int);
-
 static inline int
 xfs_buf_verify_cksum(struct xfs_buf *bp, unsigned long cksum_offset)
 {
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index d07d8f32..b5677a22 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -374,9 +374,8 @@  static inline struct xfs_buf *xfs_buf_incore(struct xfs_buftarg *target,
 	return NULL;
 }
 
-#define XBRW_READ			LIBXFS_BREAD
-#define XBRW_WRITE			LIBXFS_BWRITE
-#define xfs_buf_zero(bp,off,len)     libxfs_iomove(bp,off,len,NULL,LIBXFS_BZERO)
+#define xfs_buf_zero(bp, off, len) \
+	memset((bp)->b_addr + off, 0, len);
 
 /* mount stuff */
 #define XFS_MOUNT_32BITINODES		LIBXFS_MOUNT_32BITINODES
diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index 7430ff09..6a9895f1 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -1009,30 +1009,6 @@  libxfs_buf_mark_dirty(
 	bp->b_flags |= LIBXFS_B_DIRTY;
 }
 
-void
-libxfs_iomove(xfs_buf_t *bp, uint boff, int len, void *data, int flags)
-{
-#ifdef IO_DEBUG
-	if (boff + len > bp->b_bcount) {
-		printf("Badness, iomove out of range!\n"
-			"bp=(bno 0x%llx, bytes %u) range=(boff %u, bytes %u)\n",
-			(long long)bp->b_bn, bp->b_bcount, boff, len);
-		abort();
-	}
-#endif
-	switch (flags) {
-	case LIBXFS_BZERO:
-		memset(bp->b_addr + boff, 0, len);
-		break;
-	case LIBXFS_BREAD:
-		memcpy(data, bp->b_addr + boff, len);
-		break;
-	case LIBXFS_BWRITE:
-		memcpy(bp->b_addr + boff, data, len);
-		break;
-	}
-}
-
 /* Complain about (and remember) dropping dirty buffers. */
 static void
 libxfs_whine_dirty_buf(