Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

zloop: simplify checks for writes to sequential zones

The function zloop_rw() already checks early that a request is fully
contained within the target zone. So this check does not need to be done
again for regular writes to sequential zones. Furthermore, since zone
append operations are always directed to the zone write pointer
location, we do not need to check for their alignment to that value
after setting it. So turn the "if" checking the write pointer alignment
into an "else if".

While at it, improve the comment describing the write pointer
modification and how this value is corrected in case of error.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Damien Le Moal and committed by
Jens Axboe
e3a96ca9 cf28f6f9

+9 -10
+9 -10
drivers/block/zloop.c
··· 406 406 if (!test_bit(ZLOOP_ZONE_CONV, &zone->flags) && is_write) { 407 407 mutex_lock(&zone->lock); 408 408 409 + /* 410 + * Zone append operations always go at the current write 411 + * pointer, but regular write operations must already be 412 + * aligned to the write pointer when submitted. 413 + */ 409 414 if (is_append) { 410 415 if (zone->cond == BLK_ZONE_COND_FULL) { 411 416 ret = -EIO; ··· 418 413 } 419 414 sector = zone->wp; 420 415 cmd->sector = sector; 421 - } 422 - 423 - /* 424 - * Write operations must be aligned to the write pointer and 425 - * fully contained within the zone capacity. 426 - */ 427 - if (sector != zone->wp || zone->wp + nr_sectors > zone_end) { 416 + } else if (sector != zone->wp) { 428 417 pr_err("Zone %u: unaligned write: sect %llu, wp %llu\n", 429 418 zone_no, sector, zone->wp); 430 419 ret = -EIO; ··· 431 432 zone->cond = BLK_ZONE_COND_IMP_OPEN; 432 433 433 434 /* 434 - * Advance the write pointer of sequential zones. If the write 435 - * fails, the wp position will be corrected when the next I/O 436 - * copmpletes. 435 + * Advance the write pointer. If the write fails, the write 436 + * pointer position will be corrected when the next I/O starts 437 + * execution. 437 438 */ 438 439 zone->wp += nr_sectors; 439 440 if (zone->wp == zone_end) {