Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7722005ybl; Thu, 16 Jan 2020 04:37:44 -0800 (PST) X-Google-Smtp-Source: APXvYqw8Lxt+btO/Gb1MdZisBwAFGL3e1aztuWTGBE59hl790KwizJmu3CJRHVr6Z0vooe8kd84A X-Received: by 2002:aca:5582:: with SMTP id j124mr3749544oib.20.1579178264425; Thu, 16 Jan 2020 04:37:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579178264; cv=none; d=google.com; s=arc-20160816; b=NO62Gx9AL7FJBVOHfR7B95Q1u06nW+s6LPC7So/NCQw/dnI1VUE/a04EA/ldqi+lqh 57c0HC5mbRYB5nIg0s+Ur1cWkKuVHWuBvLgwqQ06KdfufDsDjZ98LHbhCi05Mz6QR6x9 KEuCbImHU03kO5/Y8nQo/q0NWOrZsz5P0D+PVuJZ6vvhb981uQOV5sHBr1a6ZBSBDcVA hyKLOptkOU1i5w7a2Vg/u7nNyqdLGcGmhUOUF+XXWVDK1nnaEd5edlXHwhr1ODu5Ckfx 9Jq8n6Ehn8JVcatHq2xRrRvXbID3IgAxKIbUBRGpC1AJj1Zt71xZ5ku1PlbXBXz/Vl0v fjZg== 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:to:from:subject; bh=+BdXn3ByqaczB8ydF4PWtU+LyrvwVKm/M6keLkzRrDE=; b=DLJPFdrBt/t4ASUjFjzGoOIGg/lOfRQEWftTxnFVPpfRoufGWoGkor/1ae/DdNzZsB xbITeJGuCMGZy5yR73K0JIhtkbAB+yfztK+ZzddKRLzr/r3W//oHgzHLtVrR2YcxlbJ1 A7POJH29/juVGbtaNfA1bdXz2n5jkfz00kY4Z8w55x3/FPJ2mpYSsmh3DQSk19juDySF kA00XoiPCLiEnC2pB62PEbD/xu9kGg9uWqdqo9HuacVqA5VVduSxhnKJNvJDOct38QIS 9mAxEylaPNeZ1T1Na1IHfqGDZ0kMB/mqwdk25ORJGc/+L9YMBFxHp+wA+Q16Cgw4DcfZ sagg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 x3si11350600oie.146.2020.01.16.04.37.31; Thu, 16 Jan 2020 04:37:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1726474AbgAPMgi (ORCPT + 99 others); Thu, 16 Jan 2020 07:36:38 -0500 Received: from relay.sw.ru ([185.231.240.75]:39058 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbgAPMgh (ORCPT ); Thu, 16 Jan 2020 07:36:37 -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 1is4NM-0000yM-QR; Thu, 16 Jan 2020 15:35:52 +0300 Subject: [PATCH block v2 0/3] block: Introduce REQ_NOZERO flag for REQ_OP_WRITE_ZEROES operation From: Kirill Tkhai To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, martin.petersen@oracle.com, axboe@kernel.dk, tytso@mit.edu, adilger.kernel@dilger.ca, Chaitanya.Kulkarni@wdc.com, darrick.wong@oracle.com, 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, ktkhai@virtuozzo.com Date: Thu, 16 Jan 2020 15:35:51 +0300 Message-ID: <157917805422.88675.6477661554332322975.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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (was "[PATCH RFC 0/3] block,ext4: Introduce REQ_OP_ASSIGN_RANGE to reflect extents allocation in block device internals") v2: Introduce new flag for REQ_OP_WRITE_ZEROES instead of introduction a new operation as suggested by Martin K. Petersen. Removed ext4-related patch to focus on block changes for now. 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_NOZERO flag for REQ_OP_WRITE_ZEROES, which makes a block device to allocate blocks instead of actual blocks zeroing. This may be used for forwarding user's fallocate(0) requests into block device internals. E.g., in loop driver this will result in allocation extents in backing-file, so subsequent write won't fail by the reason of no available space. Distributed network filesystems will be able to assign specific servers for specific extents, so subsequent write will be more efficient. Patch [1/3] is preparation, patch [2/3] introduces REQ_NOZERO flag and implements all the logic, patch [3/3] adds loop as the first user of the flag. Note, that here is only block-related patches, example of usage for ext4 with a performance numbers may be seen in [1]. [1] https://lore.kernel.org/linux-ext4/157599697369.12112.10138136904533871162.stgit@localhost.localdomain/T/#me5bdd5cc313e14de615d81bea214f355ae975db0 --- Kirill Tkhai (3): block: Add @flags argument to bdev_write_zeroes_sectors() block: Add support for REQ_NOZERO flag loop: Add support for REQ_NOZERO block/blk-core.c | 6 +++--- block/blk-lib.c | 17 ++++++++++------- block/blk-merge.c | 9 ++++++--- block/blk-settings.c | 17 +++++++++++++++++ drivers/block/loop.c | 15 ++++++++++++--- drivers/md/dm-kcopyd.c | 2 +- drivers/target/target_core_iblock.c | 4 ++-- fs/block_dev.c | 4 ++++ include/linux/blk_types.h | 5 ++++- include/linux/blkdev.h | 34 ++++++++++++++++++++++++++-------- 10 files changed, 85 insertions(+), 28 deletions(-) -- Signed-off-by: Kirill Tkhai