Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752621AbbG0IkX (ORCPT ); Mon, 27 Jul 2015 04:40:23 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:60065 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751217AbbG0IkW (ORCPT ); Mon, 27 Jul 2015 04:40:22 -0400 Date: Mon, 27 Jul 2015 01:40:20 -0700 From: Christoph Hellwig To: Ming Lei Cc: Jens Axboe , linux-kernel@vger.kernel.org, "Justin M. Forbes" , Jeff Moyer , Tejun Heo , Christoph Hellwig , linux-api@vger.kernel.org Subject: Re: [PATCH v7 4/6] block: loop: prepare for supporing direct IO Message-ID: <20150727084020.GA28336@infradead.org> References: <1437061068-26118-1-git-send-email-ming.lei@canonical.com> <1437061068-26118-5-git-send-email-ming.lei@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1437061068-26118-5-git-send-email-ming.lei@canonical.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 985 Lines: 31 > + /* > + * loop block's logical block size is 512, now > + * we support direct I/O only if the backing > + * block devices' minimize I/O size is 512 and > + * the offset is aligned with 512. > + */ > + if (dio) { > + if (inode->i_sb->s_bdev && > + bdev_io_min(inode->i_sb->s_bdev) == 512 && > + !(lo->lo_offset & 511)) Why the hardcoded value? I suspect this should be more like: if (dio && inode->i_sb->s_bdev && (lo->lo_offset & (bdev_io_min(inode->i_sb->s_bdev) - 1)) != 0) dio = false; > + blk_mq_freeze_queue(lo->lo_queue); > + lo->use_dio = use_dio; > + if (use_dio) > + lo->lo_flags |= LO_FLAGS_DIRECT_IO; > + else > + lo->lo_flags &= ~LO_FLAGS_DIRECT_IO; > + blk_mq_unfreeze_queue(lo->lo_queue); Locking? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/