From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from verein.lst.de ([213.95.11.211]:38520 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728252AbeJRWdJ (ORCPT ); Thu, 18 Oct 2018 18:33:09 -0400 Date: Thu, 18 Oct 2018 16:31:51 +0200 From: Christoph Hellwig To: Ming Lei Cc: Jens Axboe , linux-block@vger.kernel.org, Vitaly Kuznetsov , Dave Chinner , Linux FS Devel , "Darrick J . Wong" , xfs@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Matthew Wilcox Subject: Re: [PATCH 3/5] block: make dma_alignment as stacked limit Message-ID: <20181018143151.GC26828@lst.de> References: <20181018131817.11813-1-ming.lei@redhat.com> <20181018131817.11813-4-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181018131817.11813-4-ming.lei@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 > Cc: Dave Chinner > Cc: Linux FS Devel > Cc: Darrick J. Wong > Cc: xfs@vger.kernel.org > Cc: Dave Chinner > Cc: Christoph Hellwig > Cc: Bart Van Assche > Cc: Matthew Wilcox > Signed-off-by: Ming Lei > --- > 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);