Linux-Block Archive on
 help / color / Atom feed
From: Christoph Hellwig <>
To: "Darrick J. Wong" <>
Cc: Jens Axboe <>,
	Christoph Hellwig <>,,
	linux-fsdevel <>,
	xfs <>
Subject: Re: [PATCH] loop: fix no-unmap write-zeroes request behavior
Date: Fri, 11 Oct 2019 00:51:44 -0700
Message-ID: <> (raw)
In-Reply-To: <20191010170239.GC13098@magnolia>

On Thu, Oct 10, 2019 at 10:02:39AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <>
> Currently, if the loop device receives a WRITE_ZEROES request, it asks
> the underlying filesystem to punch out the range.  This behavior is
> correct if unmapping is allowed.  However, a NOUNMAP request means that
> the caller forbids us from freeing the storage backing the range, so
> punching out the range is incorrect behavior.

It doesn't really forbid, as most protocols don't have a way for forbid
deallocation.  It requests not to.

Otherwise this looks fine, although I would have implemented it slightly

>  	case REQ_OP_FLUSH:
>  		return lo_req_flush(lo, rq);
>  	case REQ_OP_DISCARD:
>  		return lo_discard(lo, rq, pos);
> +		return lo_zeroout(lo, rq, pos);

This could just become:

		if (rq->cmd_flags & REQ_NOUNMAP))
			return lo_zeroout(lo, rq, pos);
		return lo_discard(lo, rq, pos);

  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 17:02 Darrick J. Wong
2019-10-11  7:51 ` Christoph Hellwig [this message]
2019-10-11 16:05 ` [PATCH v2] " Darrick J. Wong
2019-10-14  7:28   ` Christoph Hellwig
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 publically 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:

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

  git send-email \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Block Archive on

Archives are clonable:
	git clone --mirror linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ \
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox