From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753513AbbCYP1v (ORCPT ); Wed, 25 Mar 2015 11:27:51 -0400 Received: from verein.lst.de ([213.95.11.211]:48380 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752530AbbCYP1u (ORCPT ); Wed, 25 Mar 2015 11:27:50 -0400 Date: Wed, 25 Mar 2015 16:27:48 +0100 From: Christoph Hellwig To: Ming Lei Cc: Christoph Hellwig , Jens Axboe , Linux Kernel Mailing List , Al Viro , Maxim Patlasov Subject: Re: [PATCH 0/3] block: loop: switch to VFS ITER_BVEC Message-ID: <20150325152748.GB12366@lst.de> References: <1427012095-4095-1-git-send-email-ming.lei@canonical.com> <20150324103219.GD7002@lst.de> <20150324180104.GA11236@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 25, 2015 at 03:23:48PM +0800, Ming Lei wrote: > > - mm_segment_t old_fs = get_fs(); > > + > > + iov_iter_bvec(&i, ITER_BVEC, bvec, 1, bvec->bv_len); > > > > file_start_write(file); > > - set_fs(get_ds()); > > - bw = file->f_op->write(file, buf, len, &pos); > > - set_fs(old_fs); > > + bw = vfs_iter_write(file, &i, ppos); > > This patch moves to support ->read_iter/->write_iter only, which > might cause regression for backing file without defining read/write > iter callback. ->read_iter/->write_iter is the main fs I/O path - by the time this is ready ->aio_read/->aio_write should be gone. > > + page = alloc_page(GFP_NOIO); > > + if (unlikely(!page)) > > + return -ENOMEM; > > The above page allocation is one code duplication. A very trivial one, isn't it? :) > IMO, lo_read/write_transfer and lo_read/write_simple can be > merged to avoid code duplication, since the logic for handling > lo->transfer in read/write is quite simple. If you have a patch that merges them while making the code smaller and simpler you're welcome. I wasn't really good enough to come up with a way that would be an improvement.