linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	Mikulas Patocka <mpatocka@redhat.com>,
	dm-devel@lists.linux.dev, Christoph Hellwig <hch@lst.de>,
	Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH v3 3/4] dm: Fix dm-zoned-reclaim zone write pointer alignment
Date: Tue, 10 Dec 2024 11:12:58 -0500	[thread overview]
Message-ID: <Z1hoipf4L1CFc6E7@kernel.org> (raw)
In-Reply-To: <20241209122357.47838-4-dlemoal@kernel.org>

On Mon, Dec 09, 2024 at 09:23:56PM +0900, Damien Le Moal wrote:
> The zone reclaim processing of the dm-zoned device mapper uses
> blkdev_issue_zeroout() to align the write pointer of a zone being used
> for reclaiming another zone, to write the valid data blocks from the
> zone being reclaimed at the same position relative to the zone start in
> the reclaim target zone.
> 
> The first call to blkdev_issue_zeroout() will try to use hardware
> offload using a REQ_OP_WRITE_ZEROES operation if the device reports a
> non-zero max_write_zeroes_sectors queue limit. If this operation fails
> because of the lack of hardware support, blkdev_issue_zeroout() falls
> back to using a regular write operation with the zero-page as buffer.
> Currently, such REQ_OP_WRITE_ZEROES failure is automatically handled by
> the block layer zone write plugging code which will execute a report
> zones operation to ensure that the write pointer of the target zone of
> the failed operation has not changed and to "rewind" the zone write
> pointer offset of the target zone as it was advanced when the write zero
> operation was submitted. So the REQ_OP_WRITE_ZEROES failure does not
> cause any issue and blkdev_issue_zeroout() works as expected.
> 
> However, since the automatic recovery of zone write pointers by the zone
> write plugging code can potentially cause deadlocks with queue freeze
> operations, a different recovery must be implemented in preparation for
> the removal of zone write plugging report zones based recovery.
> 
> Do this by introducing the new function blk_zone_issue_zeroout(). This
> function first calls blkdev_issue_zeroout() with the flag
> BLKDEV_ZERO_NOFALLBACK to intercept failures on the first execution
> which attempt to use the device hardware offload with the
> REQ_OP_WRITE_ZEROES operation. If this attempt fails, a report zone
> operation is issued to restore the zone write pointer offset of the
> target zone to the correct position and blkdev_issue_zeroout() is called
> again without the BLKDEV_ZERO_NOFALLBACK flag. The report zones
> operation performing this recovery is implemented using the helper
> function disk_zone_sync_wp_offset() which calls the gendisk report_zones
> file operation with the callback disk_report_zones_cb(). This callback
> updates the target write pointer offset of the target zone using the new
> function disk_zone_wplug_sync_wp_offset().
> 
> dmz_reclaim_align_wp() is modified to change its call to
> blkdev_issue_zeroout() to a call to blk_zone_issue_zeroout() without any
> other change needed as the two functions are functionnally equivalent.
> 
> Fixes: dd291d77cc90 ("block: Introduce zone write plugging")
> Cc: stable@vger.kernel.org
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Acked-by: Mike Snitzer <snitzer@kernel.org>

  parent reply	other threads:[~2024-12-10 16:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 12:23 [PATCH v3 0/4] Zone write plugging fixes Damien Le Moal
2024-12-09 12:23 ` [PATCH v3 1/4] block: Use a zone write plug BIO work for REQ_NOWAIT BIOs Damien Le Moal
2024-12-09 12:23 ` [PATCH v3 2/4] block: Ignore REQ_NOWAIT for zone reset and zone finish operations Damien Le Moal
2024-12-09 12:23 ` [PATCH v3 3/4] dm: Fix dm-zoned-reclaim zone write pointer alignment Damien Le Moal
2024-12-09 12:41   ` Christoph Hellwig
2024-12-10 16:12   ` Mike Snitzer [this message]
2024-12-09 12:23 ` [PATCH v3 4/4] block: Prevent potential deadlocks in zone write plug error recovery Damien Le Moal
2024-12-09 12:42   ` Christoph Hellwig
2024-12-10  1:27 ` [PATCH v3 0/4] Zone write plugging fixes Martin K. Petersen
2024-12-10 16:17 ` Jens Axboe

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=Z1hoipf4L1CFc6E7@kernel.org \
    --to=snitzer@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=dlemoal@kernel.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    /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).