public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zhang Boyang <zhangboyang.id@gmail.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	linux-block@vger.kernel.org,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Jan Kara <jack@suse.cz>, Ming Lei <ming.lei@redhat.com>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 1/1] loop: introduce LO_FLAGS_NO_DEALLOC
Date: Wed, 10 Aug 2022 19:00:00 +0800	[thread overview]
Message-ID: <e5775cbb-bd2a-decf-ad81-a861d796e3fe@gmail.com> (raw)
In-Reply-To: <YvLdc8GtbZ968qF6@magnolia>

Hi,

On 2022/8/10 06:19, Darrick J. Wong wrote:
> 
> Considering that discard isn't required to do anything, why not
> echo 0 | sudo tee /sys/block/loopX/queue/discard_max_bytes ?
> 

Thanks for reviewing! This will disable discard completely (>=5.19), 
thus the filesystem of backing file has no knowledge about what can be 
freed. In contrast, my patch convert REQ_OP_DISCARD to 
FALLOC_FL_ZERO_RANGE, the discarded parts of backing file is flagged 
zeroed. So there is possibility for the filesystem of backing file to 
discard (trim) the zeroed range, improving the write performance on, for 
example, SSDs.

However, it seems only XFS with realtime discard enabled can do trim on 
FALLOC_FL_ZERO_RANGE. All other filesystems (and XFS without realtime 
discard) can't do trim on extents flagged zeroed. Batch discard like 
FITRIM (used by `fstirm' tool) also can't help here, because no 
filesystem track `allocated but flagged zeroed' extents at filesystem 
level. I will probably write another patch to add the ability to trim 
zeroed extents in single file to FITRIM. (Currently, FITRIM work on 
filesystem level, not file level)

Best Regards,
Zhang Boyang

  reply	other threads:[~2022-08-10 11:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-06 15:30 [PATCH V2 0/1] loop: introduce LO_FLAGS_NO_DEALLOC Zhang Boyang
2022-08-06 15:30 ` [PATCH V2 1/1] " Zhang Boyang
2022-08-09 22:19   ` Darrick J. Wong
2022-08-10 11:00     ` Zhang Boyang [this message]
2022-08-11 11:40 ` Userspace support for LO_FLAGS_NO_DEALLOC (Re: [PATCH V2 0/1] loop: introduce LO_FLAGS_NO_DEALLOC) Zhang Boyang

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=e5775cbb-bd2a-decf-ad81-a861d796e3fe@gmail.com \
    --to=zhangboyang.id@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=kch@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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