From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FB79C43603 for ; Tue, 17 Dec 2019 14:17:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 506652176D for ; Tue, 17 Dec 2019 14:17:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728810AbfLQORb (ORCPT ); Tue, 17 Dec 2019 09:17:31 -0500 Received: from relay.sw.ru ([185.231.240.75]:46920 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728554AbfLQORa (ORCPT ); Tue, 17 Dec 2019 09:17:30 -0500 Received: from dhcp-172-16-24-104.sw.ru ([172.16.24.104]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1ihDeB-0005aE-AS; Tue, 17 Dec 2019 17:16:23 +0300 Subject: Re: [PATCH RFC 0/3] block,ext4: Introduce REQ_OP_ASSIGN_RANGE to reflect extents allocation in block device internals To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org, axboe@kernel.dk Cc: tytso@mit.edu, adilger.kernel@dilger.ca, ming.lei@redhat.com, osandov@fb.com, jthumshirn@suse.de, minwoo.im.dev@gmail.com, damien.lemoal@wdc.com, andrea.parri@amarulasolutions.com, hare@suse.com, tj@kernel.org, ajay.joshi@wdc.com, sagi@grimberg.me, dsterba@suse.com, chaitanya.kulkarni@wdc.com, bvanassche@acm.org, dhowells@redhat.com, asml.silence@gmail.com References: <157599668662.12112.10184894900037871860.stgit@localhost.localdomain> From: Kirill Tkhai Message-ID: <750538f7-33af-d98d-47d1-9753fd87e8fd@virtuozzo.com> Date: Tue, 17 Dec 2019 17:16:22 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <157599668662.12112.10184894900037871860.stgit@localhost.localdomain> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Hi! Any comments on this? Thanks On 10.12.2019 19:56, Kirill Tkhai wrote: > Information about continuous extent placement may be useful > for some block devices. Say, distributed network filesystems, > which provide block device interface, may use this information > for better blocks placement over the nodes in their cluster, > and for better performance. Block devices, which map a file > on another filesystem (loop), may request the same length extent > on underlining filesystem for less fragmentation and for batching > allocation requests. Also, hypervisors like QEMU may use this > information for optimization of cluster allocations. > > This patchset introduces REQ_OP_ASSIGN_RANGE, which is going > to be used for forwarding user's fallocate(0) requests into > block device internals. It rather similar to existing > REQ_OP_DISCARD, REQ_OP_WRITE_ZEROES, etc. The corresponding > exported primitive is called blkdev_issue_assign_range(). > See [1/3] for the details. > > Patch [2/3] teaches loop driver to handle REQ_OP_ASSIGN_RANGE > requests by calling fallocate(0). > > Patch [3/3] makes ext4 to notify a block device about fallocate(0). > > Here is a simple test I did: > https://gist.github.com/tkhai/5b788651cdb74c1dbff3500745878856 > > I attached a file on ext4 to loop. Then, created ext4 partition > on loop device and started the test in the partition. Direct-io > is enabled on loop. > > The test fallocates 4G file and writes from some offset with > given step, then it chooses another offset and repeats. After > the test all the blocks in the file become written. > > The results shows that batching extents-assigning requests improves > the performance: > > Before patchset: real ~ 1min 27sec > After patchset: real ~ 1min 16sec (18% better) > > Ordinary fallocate() before writes improves the performance > by batching the requests. These results just show, the same > is in case of forwarding extents information to underlining > filesystem. > --- > > Kirill Tkhai (3): > block: Add support for REQ_OP_ASSIGN_RANGE operation > loop: Forward REQ_OP_ASSIGN_RANGE into fallocate(0) > ext4: Notify block device about fallocate(0)-assigned blocks > > > block/blk-core.c | 4 +++ > block/blk-lib.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ > block/blk-merge.c | 21 ++++++++++++++ > block/bounce.c | 1 + > drivers/block/loop.c | 5 +++ > fs/ext4/ext4.h | 1 + > fs/ext4/extents.c | 11 ++++++- > include/linux/bio.h | 3 ++ > include/linux/blk_types.h | 2 + > include/linux/blkdev.h | 29 +++++++++++++++++++ > 10 files changed, 145 insertions(+), 2 deletions(-) > > -- > Signed-off-by: Kirill Tkhai >