From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:50798 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727615AbeJRVTc (ORCPT ); Thu, 18 Oct 2018 17:19:32 -0400 From: Ming Lei To: Jens Axboe Cc: linux-block@vger.kernel.org, Ming Lei , Vitaly Kuznetsov , Dave Chinner , Linux FS Devel , "Darrick J . Wong" , xfs@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Matthew Wilcox Subject: [PATCH 1/5] block: warn on un-aligned DMA IO buffer Date: Thu, 18 Oct 2018 21:18:13 +0800 Message-Id: <20181018131817.11813-2-ming.lei@redhat.com> In-Reply-To: <20181018131817.11813-1-ming.lei@redhat.com> References: <20181018131817.11813-1-ming.lei@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Now we only check if DMA IO buffer is aligned to queue_dma_alignment() for pass-through request, and it isn't done for normal IO request. Given the check has to be done on each bvec, it isn't efficient to add the check in generic_make_request_checks(). This patch addes one WARN in blk_queue_split() for capturing this issue. 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-merge.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/blk-merge.c b/block/blk-merge.c index 42a46744c11b..d2dbd508cb6d 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -174,6 +174,8 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, const unsigned max_sectors = get_max_io_size(q, bio); bio_for_each_segment(bv, bio, iter) { + WARN_ON_ONCE(queue_dma_alignment(q) & bv.bv_offset); + /* * If the queue doesn't support SG gaps and adding this * offset would create a gap, disallow it. -- 2.9.5