Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5626303ybl; Tue, 10 Dec 2019 08:58:00 -0800 (PST) X-Google-Smtp-Source: APXvYqxLr1uttDRVchsjcgzhUBJXzYcV/uSzJTJAt/WPdpQVG5XKcYBfQmFogdOfhSIOUBuGz9kp X-Received: by 2002:aca:5f87:: with SMTP id t129mr2002237oib.36.1575997080586; Tue, 10 Dec 2019 08:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575997080; cv=none; d=google.com; s=arc-20160816; b=O/BPg28dxjMkd5qfoLvU6/3ETIAF6YmIcm7HXtJMx6D7Hi5j/Nvw3CWXwVwO2DQuMB CDi6dqA72SUcw5EfcXYAPscuLyCR95juxpo+YIXY1x6dTaAaaGHVrF45AzRyJkbvi4oF 7P+wSUePNg1+kcuFSDcY1E0ZKn6+njgBPDZFmeJ7FdMWbdf8iu3II+O8OS2W14ZpYWur TZWaS/QD8YQUpNAZA3T1iOPTqfLqxOeOIFi+Tk3zA2Jifj+QOyciRo3W1vDhRgARTL9E KaoNO8KIKahl6EjZNQluf9gjDMvlTiylvJuM9vEPt/3V4gHvksSmUcM0HdAG/iCsTaPo oCDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject; bh=T2M8WS0JIuppwjIYLEWvhYPYP6rk/iMjhgqvHEtyfQY=; b=FUeVPK0GcNXs+BJLtHjceRhDp6FJqOOHJyb9zT+ero65pnIq2ZZNcqnqVGg+5d23EL GXFckeSkzD2ButpGOXZ3XcqrqMLEhXk947TDNt6Uz69aeHDHJyTzT4/3xeU85TTYYW31 MRy/n4OpeOAmdIF+gwar1S1tbYJsXDejTYmkcz8wWl9U472NdUBdNTmIH2Celwigsd28 XySZcHaDcnpbyJJrMeVf1tfRwUqcRQJ1NKKsGmA+/7vPk8hYSwOcx6slzSWMlfVjp/Ri ebQLX9eX0isx+E40TkD/GqAdtxxBmqkizVx0jBqA+72pbc9N8Flqe9YFeDE9zxFRNESe aVGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14si2455150otk.2.2019.12.10.08.57.49; Tue, 10 Dec 2019 08:58:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727633AbfLJQ5G (ORCPT + 99 others); Tue, 10 Dec 2019 11:57:06 -0500 Received: from relay.sw.ru ([185.231.240.75]:36456 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727577AbfLJQ5F (ORCPT ); Tue, 10 Dec 2019 11:57:05 -0500 Received: from dhcp-172-16-24-104.sw.ru ([172.16.24.104] helo=localhost.localdomain) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1ieinq-0006xy-Up; Tue, 10 Dec 2019 19:56:03 +0300 Subject: [PATCH RFC 0/3] block,ext4: Introduce REQ_OP_ASSIGN_RANGE to reflect extents allocation in block device internals From: Kirill Tkhai To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org Cc: axboe@kernel.dk, 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, ktkhai@virtuozzo.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 Date: Tue, 10 Dec 2019 19:56:02 +0300 Message-ID: <157599668662.12112.10184894900037871860.stgit@localhost.localdomain> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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