linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@infradead.org>,
	linux-block@vger.kernel.org,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH v2] loop: fix no-unmap write-zeroes request behavior
Date: Mon, 14 Oct 2019 00:28:49 -0700	[thread overview]
Message-ID: <20191014072849.GA11648@infradead.org> (raw)
In-Reply-To: <20191011160545.GD13098@magnolia>

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);

  reply	other threads:[~2019-10-14  7:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 17:02 [PATCH] loop: fix no-unmap write-zeroes request behavior Darrick J. Wong
2019-10-11  7:51 ` Christoph Hellwig
2019-10-11 16:05 ` [PATCH v2] " Darrick J. Wong
2019-10-14  7:28   ` Christoph Hellwig [this message]
2019-10-14 15:50 ` [PATCH v3] " Darrick J. Wong
2019-10-14 16:39   ` Eric Sandeen
2019-10-14 17:00     ` Darrick J. Wong
2019-10-15  7:58   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191014072849.GA11648@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=darrick.wong@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).