[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150507072400.GC7595@infradead.org>
Date: Thu, 7 May 2015 00:24:00 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Ming Lei <ming.lei@...onical.com>
Cc: linux-kernel@...r.kernel.org,
Dave Kleikamp <dave.kleikamp@...cle.com>,
Jens Axboe <axboe@...nel.dk>, Zach Brown <zab@...bo.net>,
Christoph Hellwig <hch@...radead.org>,
Maxim Patlasov <mpatlasov@...allels.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Tejun Heo <tj@...nel.org>, util-linux@...r.kernel.org
Subject: Re: [PATCH v3 4/4] block: loop: support DIO & AIO
> @@ -441,6 +500,12 @@ static void do_loop_switch(struct loop_device *lo, struct switch_request *p)
> mapping->host->i_bdev->bd_block_size : PAGE_SIZE;
> lo->old_gfp_mask = mapping_gfp_mask(mapping);
> mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
> +
> + lo->support_dio = mapping->a_ops && mapping->a_ops->direct_IO;
> + if (lo->support_dio)
> + lo->use_aio = true;
> + else
> + lo->use_aio = false;
We need an explicit userspace op-in for this. For one direct I/O can't
handle sub-sector size access and people use the loop device as a
workaround for that. Second this doesn't give anyone seeing negative
results from aio a way to disable it easily.
It think the best way is to require a setup time flag, but enable it to
on in losetup versions that know about it.
> @@ -761,6 +826,13 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
> if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync)
> blk_queue_flush(lo->lo_queue, REQ_FLUSH);
>
> + /* use aio if it is possible */
> + lo->support_dio = mapping->a_ops && mapping->a_ops->direct_IO;
> + if (lo->support_dio)
> + lo->use_aio = true;
> + else
> + lo->use_aio = false;
Please always factor out checks like this insted of duplicating them.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists