Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp423823ybl; Fri, 31 Jan 2020 01:17:51 -0800 (PST) X-Google-Smtp-Source: APXvYqwmVKnzgzJLK0aPMUrAQfM7OLyHOqothSZK/lhLiImoS8w02v00wpixIR8SLv048UZoELtm X-Received: by 2002:a9d:23b5:: with SMTP id t50mr6729108otb.122.1580462271080; Fri, 31 Jan 2020 01:17:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580462271; cv=none; d=google.com; s=arc-20160816; b=HusAmLEXQkflj6hTY/cisJNWQpOmBqCMAWme0WsUd3sBDXyTlrClEjbzMCA7WKBpOo K1nx39I1/aznAT977EgMEQO7We6CRpnLSjPJiscJLhGYL5+9UajqOAISuWUXbTWLtDxL bgFq8z6noE9AULjXhFdM8t3mKcC4mEhtyhqyW5GG+qGHlm9jcJJRzBB/EQv73cRFwEs0 8c+UFPz4UvnTf07fB5DsRsQ87BonGU4pwTn1++rgRJBcjHCGngW8tSXpRxxAXj+IFNAe E/1RdyQTq6oPh9RLJ/jGcwGWNhfckVErFfm1x1apIsvrb+1wSYec5bd6+6S06iVEwmp3 74ug== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=SAxqTCpOdVnVI+48IV0RHTfsWqwhART0EXJpWjkkOzo=; b=0FhRt+G8avYrXrPQ4uIiKRf/aOsFx5NBynH0tjE1yvbz1OgdQ2XqClFLuvFF2Foc1A 2GO66b5oSRhx8LqNeQsokmvN/FD/1/MmbttnmU+fS1w6aBhstAOnHGGH5v2FJcxgQQmj n3gGl5ve9dNVO/qXJ4lpSwD7Doolaimqu5mUDB3ZnmQBJ27N2M4fJQb+7/XVZjbQE2Te XM5jo2GMTT4uH8oSdxeRh072wQPeGZAs+ItxuVf2Ar7UCzPaBISjvXmeZcdAvmHoeNvP tTT/mfGIbxuVN+hROCNHTtREstdlwug6RCzM/9eQE76ZaQieCROBTMdLFO8fm2AWypQG qk8w== 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 m24si4108807oic.11.2020.01.31.01.17.36; Fri, 31 Jan 2020 01:17:51 -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 S1728214AbgAaJQd (ORCPT + 99 others); Fri, 31 Jan 2020 04:16:33 -0500 Received: from relay.sw.ru ([185.231.240.75]:39718 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728159AbgAaJQd (ORCPT ); Fri, 31 Jan 2020 04:16:33 -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 1ixSOT-0007Vt-8L; Fri, 31 Jan 2020 12:15:17 +0300 Subject: Re: [PATCH block v2 2/3] block: Add support for REQ_NOZERO flag To: Christoph Hellwig , "Martin K. Petersen" Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, 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, bvanassche@acm.org, dhowells@redhat.com, asml.silence@gmail.com References: <157917805422.88675.6477661554332322975.stgit@localhost.localdomain> <157917816325.88675.16481772163916741596.stgit@localhost.localdomain> <20200131062343.GA6267@infradead.org> From: Kirill Tkhai Message-ID: <683bb62a-9667-d2c7-0437-7a6343819382@virtuozzo.com> Date: Fri, 31 Jan 2020 12:15:17 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <20200131062343.GA6267@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Christoph, On 31.01.2020 09:23, Christoph Hellwig wrote: > On Tue, Jan 21, 2020 at 01:14:05AM -0500, Martin K. Petersen wrote: >> I find there is some dissonance between using BLKDEV_ZERO_ALLOCATE to >> describe this operation in one case and REQ_NOZERO in the other. >> >> I understand why not zeroing is important in your case. However, I think >> the allocation aspect is semantically more important. Also, in the case >> of SCSI, the allocated blocks will typically appear zeroed. So from that >> perspective REQ_NOZERO doesn't really make sense. I would really prefer >> to use REQ_ALLOCATE to describe this operation. I agree that "do not >> write every block" is important too. I just don't have a good suggestion >> for how to express that as an additional qualifier to REQ_ALLOCATE_?. > > Agreed. Nevermind the problem of a REQ_OP_WRITE_ZEROES operations with > a NOZERO flag causing a massive confusion to the reader. > >> Also, adding to the confusion: In the context of SCSI, ANCHOR requires >> UNMAP. So my head hurts a bit when I read REQ_NOZERO|REQ_NOUNMAP and >> have to translate that into ANCHOR|UNMAP. >> >> Longer term, I think we should consider introducing REQ_OP_SINGLE_RANGE >> or something like that as an umbrella operation that can be used to >> describe zeroing, allocating, and other things that operate on a single >> LBA range with no payload. Thus removing both the writiness and the >> zeroness from the existing REQ_OP_WRITE_ZEROES conduit. > > What is the benefit of a multipler there? Given all this flags > confusion I'm almost tempted to just split up REQ_OP_WRITE_ZEROES into > REQ_OP_ALLOCATE ("cheap") and REQ_OP_WRITE_ZEROES ("potentially > expensive") and just let the caller handle the difference. Everytime > we try to encode semantic differences into flags we're eventually > running into trouble. Sais the person that added REQ_UNMAP.. We started from separated REQ_OP_ASSIGN_RANGE in v1, but then we decided to use a modifier because this looks better and scatters less over I/O stack. See "[PATCH RFC 0/3] block,ext4: Introduce REQ_OP_ASSIGN_RANGE to reflect extents allocation in block device internals" series for the details. (https://lkml.org/lkml/2020/1/7/1616 and neighbouring messages). Last version of the patchset is v5 and it's here: https://lkml.org/lkml/2020/1/22/643 Kirill