Commit f9a196ee authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: merge xfs_buf_zero and xfs_buf_iomove

xfs_buf_zero is the only caller of xfs_buf_iomove.  Remove support
for copying from or to the buffer in xfs_buf_iomove and merge the
two functions.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 8c9ce2f7
...@@ -1613,16 +1613,11 @@ xfs_buf_offset( ...@@ -1613,16 +1613,11 @@ xfs_buf_offset(
return page_address(page) + (offset & (PAGE_SIZE-1)); return page_address(page) + (offset & (PAGE_SIZE-1));
} }
/*
* Move data into or out of a buffer.
*/
void void
xfs_buf_iomove( xfs_buf_zero(
xfs_buf_t *bp, /* buffer to process */ struct xfs_buf *bp,
size_t boff, /* starting buffer offset */ size_t boff,
size_t bsize, /* length to copy */ size_t bsize)
void *data, /* data address */
xfs_buf_rw_t mode) /* read/write/zero flag */
{ {
size_t bend; size_t bend;
...@@ -1639,19 +1634,9 @@ xfs_buf_iomove( ...@@ -1639,19 +1634,9 @@ xfs_buf_iomove(
ASSERT((csize + page_offset) <= PAGE_SIZE); ASSERT((csize + page_offset) <= PAGE_SIZE);
switch (mode) {
case XBRW_ZERO:
memset(page_address(page) + page_offset, 0, csize); memset(page_address(page) + page_offset, 0, csize);
break;
case XBRW_READ:
memcpy(data, page_address(page) + page_offset, csize);
break;
case XBRW_WRITE:
memcpy(page_address(page) + page_offset, data, csize);
}
boff += csize; boff += csize;
data += csize;
} }
} }
......
...@@ -21,12 +21,6 @@ ...@@ -21,12 +21,6 @@
#define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL)) #define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL))
typedef enum {
XBRW_READ = 1, /* transfer into target memory */
XBRW_WRITE = 2, /* transfer from target memory */
XBRW_ZERO = 3, /* Zero target memory */
} xfs_buf_rw_t;
#define XBF_READ (1 << 0) /* buffer intended for reading from device */ #define XBF_READ (1 << 0) /* buffer intended for reading from device */
#define XBF_WRITE (1 << 1) /* buffer intended for writing to device */ #define XBF_WRITE (1 << 1) /* buffer intended for writing to device */
#define XBF_READ_AHEAD (1 << 2) /* asynchronous read-ahead */ #define XBF_READ_AHEAD (1 << 2) /* asynchronous read-ahead */
...@@ -305,10 +299,7 @@ static inline int xfs_buf_submit(struct xfs_buf *bp) ...@@ -305,10 +299,7 @@ static inline int xfs_buf_submit(struct xfs_buf *bp)
return __xfs_buf_submit(bp, wait); return __xfs_buf_submit(bp, wait);
} }
extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, void *, void xfs_buf_zero(struct xfs_buf *bp, size_t boff, size_t bsize);
xfs_buf_rw_t);
#define xfs_buf_zero(bp, off, len) \
xfs_buf_iomove((bp), (off), (len), NULL, XBRW_ZERO)
/* Buffer Utility Routines */ /* Buffer Utility Routines */
extern void *xfs_buf_offset(struct xfs_buf *, size_t); extern void *xfs_buf_offset(struct xfs_buf *, size_t);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment