From patchwork Mon Feb 10 09:33:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 11372921 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3423E1805 for ; Mon, 10 Feb 2020 09:45:11 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E441121739 for ; Mon, 10 Feb 2020 09:45:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JWiofnM+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E441121739 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581327909; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=GznGIn6plubGhzrZDJDJ6gCnJLKxykHHM4XbDUGaVAY=; b=JWiofnM+yj+hHoVsWe9rxGSVFaxa5cZsxYDqL+hGuTQiFwCUw88nsfeKhZJiJLGkp/1wLG stBNmXoMpLz7+AZptRbe9C7rsSLZCfX0KaDGwvasjzk2n2IaCzdnEPR4kgN+6jOjdRVgq2 P9HmurXl1NDMk9VENaUl7G9MULgh28k= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-389-SVexpL-uMKeuFrLA0vi0ww-1; Mon, 10 Feb 2020 04:45:07 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15F2CDBA9; Mon, 10 Feb 2020 09:45:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC52426FB0; Mon, 10 Feb 2020 09:45:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6D8F8866D5; Mon, 10 Feb 2020 09:45:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01A9YcFb000911 for ; Mon, 10 Feb 2020 04:34:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id AF98010E51CD; Mon, 10 Feb 2020 09:34:38 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB04D10E51B4 for ; Mon, 10 Feb 2020 09:34:36 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 00FC8800F48 for ; Mon, 10 Feb 2020 09:34:36 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-197-9oBEzp2MMROYAYzqI2GszQ-1; Mon, 10 Feb 2020 04:34:32 -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 1j15Rb-0000JT-Nw; Mon, 10 Feb 2020 12:33:31 +0300 From: Kirill Tkhai To: martin.petersen@oracle.com, bob.liu@oracle.com, axboe@kernel.dk Date: Mon, 10 Feb 2020 12:33:31 +0300 Message-ID: <158132703141.239613.3550455492676290009.stgit@localhost.localdomain> User-Agent: StGit/0.19 MIME-Version: 1.0 X-MC-Unique: 9oBEzp2MMROYAYzqI2GszQ-1 X-MC-Unique: SVexpL-uMKeuFrLA0vi0ww-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01A9YcFb000911 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 10 Feb 2020 04:44:34 -0500 Cc: andrea.parri@amarulasolutions.com, snitzer@redhat.com, dhowells@redhat.com, song@kernel.org, dm-devel@redhat.com, adilger.kernel@dilger.ca, osandov@fb.com, agk@redhat.com, hare@suse.com, bvanassche@acm.org, darrick.wong@oracle.com, minwoo.im.dev@gmail.com, jthumshirn@suse.de, ajay.joshi@wdc.com, chaitanya.kulkarni@wdc.com, ming.lei@redhat.com, linux-block@vger.kernel.org, ktkhai@virtuozzo.com, dsterba@suse.com, sagi@grimberg.me, damien.lemoal@wdc.com, tytso@mit.edu, linux-kernel@vger.kernel.org, tj@kernel.org, asml.silence@gmail.com Subject: [dm-devel] [PATCH v6 0/6] block: Introduce REQ_ALLOCATE flag for REQ_OP_WRITE_ZEROES X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com (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") v6: req_op() cosmetic change. 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 Reviewed-by: Bob Liu -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel