diff mbox series

[2/3] xfs: get allocation alignment from the buftarg

Message ID 20190826014007.10877-3-david@fromorbit.com (mailing list archive)
State Accepted
Headers show
Series [1/3] xfs: add kmem allocation trace points | expand

Commit Message

Dave Chinner Aug. 26, 2019, 1:40 a.m. UTC
From: Dave Chinner <dchinner@redhat.com>

Needed to feed into the allocation routine to guarantee the memory
buffers we add to bios are correctly aligned to the underlying
device.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_buf.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Christoph Hellwig Aug. 26, 2019, 7:48 a.m. UTC | #1
On Mon, Aug 26, 2019 at 11:40:06AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Needed to feed into the allocation routine to guarantee the memory
> buffers we add to bios are correctly aligned to the underlying
> device.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

I don't really see the real need for the wrapper, but it also doesn't
seem actively harmful, so:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index c6e57a3f409e..f6ce17d8d848 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -350,6 +350,12 @@  extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int);
 #define xfs_getsize_buftarg(buftarg)	block_size((buftarg)->bt_bdev)
 #define xfs_readonly_buftarg(buftarg)	bdev_read_only((buftarg)->bt_bdev)
 
+static inline int
+xfs_buftarg_dma_alignment(struct xfs_buftarg *bt)
+{
+	return queue_dma_alignment(bt->bt_bdev->bd_disk->queue);
+}
+
 int xfs_buf_reverify(struct xfs_buf *bp, const struct xfs_buf_ops *ops);
 bool xfs_verify_magic(struct xfs_buf *bp, __be32 dmagic);
 bool xfs_verify_magic16(struct xfs_buf *bp, __be16 dmagic);