Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp629785ybg; Thu, 19 Mar 2020 06:06:19 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsmgB15gAmQYjImX5DGfchL1+cBRSYEWkVXlbYRLAqFBX1OTYyYsygA05/S1w2tBs3Qao8j X-Received: by 2002:aca:5208:: with SMTP id g8mr2120869oib.169.1584623179787; Thu, 19 Mar 2020 06:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584623179; cv=none; d=google.com; s=arc-20160816; b=XzC/wxg22RV6yKHMMt9nl+Forcc6GZgaYT079hUDA7iVGPlmgE+OE9VeXNcZWHHpDW wm4AUrDbtFY+Bk9cjqhaJe9/MK5tHuq95zpBNjvHu+kAxtoIacoTRJNkucFk9rZZmjlG izuR8wka9/929H3eCgep+lerkHqizRBeF6HCQBCR6qr7nrP975Hs2pUq4AQS1QCHr8p2 uFXQ1tPlaRHnb+6L8OTm2xp5CB1briKz33cNJ8C3MlEkpLyYNr9XMvjy1NiLsR38wo0x DAWRME6q8KLy/ddRY4JPGgMGk331TWNuWPaSowHsR9t1DxZD33c9S912BRWcJVTAfFZf LJWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:organization:from:subject:cc:to :dkim-signature; bh=eDCn48rp2SyuINnEnWSJhbWLS5pcJCnUMKz117As80E=; b=TQERlqX3Gj1LWg2iw9OCDC1GykMyE3YyaddP8Hp1ujsc1WA5eMCPsUHaXr+bttzrjh zGUvSj2reAaP9sOAptdgoRSOzjhCJbdLgWdWUG7yM/DDP8lDt2zxqM7pm4J/ytb3mekr tUqMyu0Xq9YX9d6IwRZJgL0jGEwE+shkBdbp9he2loP241jIhgFqECAPgsbPBay9g/cu jg9q9HKT5MqDwKDG7UXYK5g0EisltTSIM/St8Fv5cyo3mupJFNXqtcliCf1U9ii62RcT DlyajC34W8+A1rZf2Ka/9jUL+uc3xxKidEKiFTmk0AEwx4PIQTTxWzVlJMAZb64oDv9N hvtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=sRM7oLvM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y19si1215375oti.268.2020.03.19.06.05.31; Thu, 19 Mar 2020 06:06:19 -0700 (PDT) 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; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=sRM7oLvM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727202AbgCSNEe (ORCPT + 99 others); Thu, 19 Mar 2020 09:04:34 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:51954 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbgCSNEe (ORCPT ); Thu, 19 Mar 2020 09:04:34 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02JCm67j104557; Thu, 19 Mar 2020 13:03:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : subject : from : references : date : in-reply-to : message-id : mime-version : content-type; s=corp-2020-01-29; bh=eDCn48rp2SyuINnEnWSJhbWLS5pcJCnUMKz117As80E=; b=sRM7oLvMdOz6FXLMOfiyu2MaOGxcUX+K2BpTbblN0jUCqpqTam90e2wWTY0kIK0dvPls BnUHHr7Ugtjvd6v0dH3vYlDa2o6EAqGGx3curiG+tZ6Yv9c/EVX2RTFHj0ejmvEKaprQ EUVioEoGVNd64BJBgzYu/LI0+QEfPqfbsSKBy2BBUs0VA7KvgtKSq9FRQlXHi6yokNlG 0NW78RY4czQVRvkz5efvlDNSLj+ZqHdPjOpiXr4jXufR54gxl0b25FuS1knIxUx8U8tY XCocrA1gY40a7cq9Noi7l0TfFmaaca1chfTfc4bfM3o0ohx/JT08WC7E3u9fC6LU/O31 tg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2yub278093-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Mar 2020 13:03:50 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02JCohiE179280; Thu, 19 Mar 2020 13:03:50 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 2ys9040cm4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Mar 2020 13:03:50 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 02JD3kap006935; Thu, 19 Mar 2020 13:03:46 GMT Received: from ca-mkp.ca.oracle.com (/10.159.214.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 19 Mar 2020 06:03:45 -0700 To: Christoph Hellwig Cc: Kirill Tkhai , axboe@kernel.dk, martin.petersen@oracle.com, bob.liu@oracle.com, darrick.wong@oracle.com, agk@redhat.com, snitzer@redhat.com, dm-devel@redhat.com, song@kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, Chaitanya.Kulkarni@wdc.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, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 0/6] block: Introduce REQ_ALLOCATE flag for REQ_OP_WRITE_ZEROES From: "Martin K. Petersen" Organization: Oracle Corporation References: <158157930219.111879.12072477040351921368.stgit@localhost.localdomain> <69c0b8a4-656f-98c4-eb55-2fd1184f5fc9@virtuozzo.com> <67d63190-c16f-cd26-6b67-641c8943dc3d@virtuozzo.com> <20200319102819.GA26418@infradead.org> Date: Thu, 19 Mar 2020 09:03:40 -0400 In-Reply-To: <20200319102819.GA26418@infradead.org> (Christoph Hellwig's message of "Thu, 19 Mar 2020 03:28:19 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9564 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=835 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003190058 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9564 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 impostorscore=0 mlxlogscore=896 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 clxscore=1011 priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003190058 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christoph, >> Some comments? Some requests for reworking? Some personal reasons to >> ignore my patches? > > I'm still completely opposed to the magic overloading using a flag. > That is just a bad design waiting for trouble to happen. The observation was that Kirill's original patch set was a line-for-line carbon copy of the write zeroes handling throughout the stack. The only difference between the two was at the bottom. Instead of duplicating all that code it seemed cleaner to use shared plumbing since these operations need to be split and merged exactly the same way in the block layer. Also, we already have REQ_NOUNMAP, not sure why an additional handling flag would lead to trouble? Note that I suggested renaming REQ_OP_WRITE_ZEROES to something else to separate the semantics from the plumbing. We need to be able to express: - zero & allocate block range (REQ_OP_WRITE_ZEROES, REQ_NOUNMAP) - zero & deallocate block range (REQ_OP_WRITE_ZEROES, !REQ_NOUNMAP) - allocate block range (?, don't care about zeroing) - deallocate block range (REQ_OP_DISCARD, don't care about zeroing) It just seems like a full-fledged REQ_OP_ALLOCATE is an overkill to fill that gap. That said, I do think that we have traditionally put emphasis on the wrong part of these operations. All we ever talk about wrt. discard and friends is the zeroing aspect. But I actually think that, semantically, the act of allocating and deallocating blocks is more important. And that zeroing is an optional second order effect of those operations. So if we could go back in time and nuke multi-range DSM TRIM/UNMAP, I would like to have REQ_OP_ALLOCATE/REQ_OP_DEALLOCATE with an optional REQ_ZERO flag. I think that would be cleaner. I have a much easier time wrapping my head around "allocate this block and zero it if you can" than "zero this block and do not deallocate it". But maybe that's just me. -- Martin K. Petersen Oracle Linux Engineering