Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4692768ybl; Wed, 22 Jan 2020 03:00:15 -0800 (PST) X-Google-Smtp-Source: APXvYqyxB0+mdrvRXmPQVdI79uYkMfFYeKSTR+UT8Tlgn0B7Sserl2fNXw3gG6zIWkyd+pr+sXSt X-Received: by 2002:a9d:4c82:: with SMTP id m2mr6948753otf.199.1579690815116; Wed, 22 Jan 2020 03:00:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579690815; cv=none; d=google.com; s=arc-20160816; b=scI0LGLizehmo371OIZ8QXeYZltFxDFHfS/eOOuNr9ze/fWPQeXc2IJV/GBh/yD9wY GloVnkeEEI+actZ2lNGA7MDfLAWhSFvcyPhHTsw+weercUvyo2wiHviQBecDpO0Fsjrc 2rXaohieoBGvgVMsEjIMTYqhwNw3of+olmD64mtFIOpJL4EiuUatn4nnXYL4PPhtoEBp ijT8D1kYksPFbps3qkig06NOndoVg57Uf/gsa7eFVHvTOrmugFd3bAHcoEXVCq0utMNk Pu5ixpBBBdeiLLLhKdpbEVqZv9SIF2onYRuQnj0Zit5ACKrw2COCPgICMpumPzWL9iGp xRoQ== 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=3kZ1IW4AIN7Vpd4+nQdTmq8DxPc/Em/MoEPL/pVHYag=; b=kzZ3QFz1ewmzPIL0XyyR6t+/fiFdM1718HKvsdmF2Tznt56dB/WuNGZ1e1WmDNRVL3 9FsTp+lUOnbcV6SGqlr3wz3fNgQg5SpTK1MJze6UEoOC4gq0ncOd8DOkQedlYbBtQEgH 3dTVM+Uw/4QkopN4ODC5VVNfQUEpBLhG48Oae3OXDOAbaM/Isb2MH6AEl04iM8if80+T Ho1lCXxqdhA3RVw/5SaxcoBj9qWlHcrcG/L4rCDpz5c+eqR4TPLAJydYs1S9YqmnEsrh ADyAythtBoFBtyBVyVoRTUyHzc06bYl0QNnGlgTJWMxECyZcZeoCNCLvCMiTM1GO5OZY 42wg== 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 14si20351146oie.181.2020.01.22.03.00.02; Wed, 22 Jan 2020 03:00:15 -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 S1729261AbgAVK6d (ORCPT + 99 others); Wed, 22 Jan 2020 05:58:33 -0500 Received: from relay.sw.ru ([185.231.240.75]:49984 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbgAVK63 (ORCPT ); Wed, 22 Jan 2020 05:58:29 -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 1iuDho-0002gJ-Kd; Wed, 22 Jan 2020 13:57:52 +0300 Subject: [PATCH v5 0/6] block: Introduce REQ_ALLOCATE flag for REQ_OP_WRITE_ZEROES From: Kirill Tkhai To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, martin.petersen@oracle.com, bob.liu@oracle.com, axboe@kernel.dk, agk@redhat.com, snitzer@redhat.com, dm-devel@redhat.com, song@kernel.org, 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: Wed, 22 Jan 2020 13:57:52 +0300 Message-ID: <157968992539.174869.7490844754165043549.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 block v2 0/3] block: Introduce REQ_NOZERO flag for REQ_OP_WRITE_ZEROES operation"; was "[PATCH RFC 0/3] block,ext4: Introduce REQ_OP_ASSIGN_RANGE to reflect extents allocation in block device internals") v5: Kill dm|md patch, which disables REQ_ALLOCATE for these devices. Disable REQ_ALLOCATE for all stacking devices instead of this. v4: Correct argument for mddev_check_write_zeroes(). v3: Rename REQ_NOZERO to REQ_ALLOCATE. Split helpers to separate patches. Add a patch, disabling max_allocate_sectors inheritance for dm. 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_ALLOCATE 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. Patches [1-3/6] are preparation on helper functions, patch [4/6] introduces REQ_ALLOCATE flag and implements all the logic, patch [5/6] adds one more helper, patch [6/6] 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 (6): block: Add @flags argument to bdev_write_zeroes_sectors() block: Pass op_flags into blk_queue_get_max_sectors() block: Introduce blk_queue_get_max_write_zeroes_sectors() block: Add support for REQ_ALLOCATE flag block: Add blk_queue_max_allocate_sectors() loop: Add support for REQ_ALLOCATE 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