Re: [PATCH 3/5] block: make dma_alignment as stacked limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 18, 2018 at 09:18:15PM +0800, Ming Lei wrote:
> This patch converts .dma_alignment into stacked limit, so the stack
> driver may get updated with underlying dma alignment, and allocate
> IO buffer as queue DMA aligned.
> 
> Cc: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
> Cc: Dave Chinner <dchinner@xxxxxxxxxx>
> Cc: Linux FS Devel <linux-fsdevel@xxxxxxxxxxxxxxx>
> Cc: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> Cc: xfs@xxxxxxxxxxxxxxx
> Cc: Dave Chinner <dchinner@xxxxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Bart Van Assche <bvanassche@xxxxxxx>
> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
> ---
>  block/blk-settings.c | 89 +++++++++++++++++++++++++++++-----------------------
>  1 file changed, 50 insertions(+), 39 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index cf9cd241dc16..aef4510a99b6 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -525,6 +525,54 @@ void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
>  EXPORT_SYMBOL(blk_queue_stack_limits);
>  
>  /**
> + * blk_queue_dma_alignment - set dma length and memory alignment
> + * @q:     the request queue for the device
> + * @mask:  alignment mask
> + *
> + * description:
> + *    set required memory and length alignment for direct dma transactions.
> + *    this is used when building direct io requests for the queue.
> + *
> + **/
> +void blk_queue_dma_alignment(struct request_queue *q, int mask)
> +{
> +	q->limits.dma_alignment = mask;
> +}
> +EXPORT_SYMBOL(blk_queue_dma_alignment);

Any good reason not to keep these functions where they were before?

> +
> +static int __blk_queue_update_dma_alignment(struct queue_limits *t, int mask)
> +{
> +	BUG_ON(mask >= PAGE_SIZE);
> +
> +	if (mask > t->dma_alignment)
> +		return mask;
> +	else
> +		return t->dma_alignment;

I think this function could just be replaced with a:

	max(t->dma_alignment, mask);



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux