From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8912C4CECE for ; Mon, 14 Oct 2019 07:28:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C7D720854 for ; Mon, 14 Oct 2019 07:28:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="IR4Q83C+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728931AbfJNH2v (ORCPT ); Mon, 14 Oct 2019 03:28:51 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55528 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728811AbfJNH2v (ORCPT ); Mon, 14 Oct 2019 03:28:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QJ5EW5ff7pmcGUbSLwYEYEOoJqNr7X6VvllZr/eSBh0=; b=IR4Q83C+T53loqKsaRD0rTPlD q/GSVzxCVVDhfLlq4L7E1crnpazbnftDQw3Tvl7PP1S/ddKVYB4Ua1WLtdnaMqy6rMAgpB1trQuXH CQh/CMB2omkADp8AV+cXNrslK+jx2DK982kECm439o9OxPuh+eGLSt2ayPM8f904jkuj2RfzdtVBe L7UEV/QZZc+CTFEzFQDQFOVPdlxI/w3q/xxxiccJ1GJJ+gfm4asduoeqmT0fp4gpg2ygKU5EUmxjE BLuV1k1s4QseuY5XZFV0unWN+PDN1b24usAzgmP9uncW6p4bS9JGxRMV1Xeauph0+GoylljapH01h u5NQzK8+Q==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iJumf-0005oY-N6; Mon, 14 Oct 2019 07:28:49 +0000 Date: Mon, 14 Oct 2019 00:28:49 -0700 From: Christoph Hellwig To: "Darrick J. Wong" Cc: Jens Axboe , Christoph Hellwig , linux-block@vger.kernel.org, linux-fsdevel , xfs Subject: Re: [PATCH v2] loop: fix no-unmap write-zeroes request behavior Message-ID: <20191014072849.GA11648@infradead.org> References: <20191010170239.GC13098@magnolia> <20191011160545.GD13098@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191011160545.GD13098@magnolia> User-Agent: Mutt/1.12.1 (2019-06-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org While this looks generally good to me, I have another nitpick to avoid code duplication. What about just renaming lo_discard to lo_fallocate and pass the mode (possibly minus the FALLOC_FL_KEEP_SIZE flag) to it? The in the do_req_filebacked we could further simplify it down to: case REQ_OP_WRITE_ZEROES: /* * If the caller doesn't want deallocation, call zeroout to * write zeroes the range. Otherwise, punch them out. */ return lo_fallocate(lo, rq, pos, (rq->cmd_flags & REQ_NOUNMAP) ? FALLOC_FL_ZERO_RANGE : FALLOC_FL_PUNCH_HOLE); break; case REQ_OP_DISCARD: return lo_fallocate(lo, rq, pos, FALLOC_FL_PUNCH_HOLE);