Lines Matching full:zone
36 * With ZNS drives, closing an explicitly open zone that has not been in zonefs_zone_mgmt()
37 * written will change the zone state to "closed", that is, the zone in zonefs_zone_mgmt()
39 * open operation on other zones if the drive active zone resources in zonefs_zone_mgmt()
40 * are exceeded, make sure that the zone does not remain active by in zonefs_zone_mgmt()
50 "Zone management operation %s at %llu failed %d\n", in zonefs_zone_mgmt()
64 * A full zone is no longer open/active and does not need in zonefs_i_size_write()
128 * zones, all blocks after always mapped below the inode size (zone in zonefs_write_iomap_begin()
163 * Map blocks for page writeback. This is used only on conventional zone files,
212 "swap file: not a conventional zone file\n"); in zonefs_swap_activate()
268 * Check a zone condition and adjust its file inode access permissions for
270 * amount of readable data in the zone.
273 struct blk_zone *zone, bool warn, in zonefs_check_zone_condition() argument
278 switch (zone->cond) { in zonefs_check_zone_condition()
281 * Dead zone: make the inode immutable, disable all accesses in zonefs_check_zone_condition()
282 * and set the file size to 0 (zone wp set to zone start). in zonefs_check_zone_condition()
285 zonefs_warn(inode->i_sb, "inode %lu: offline zone\n", in zonefs_check_zone_condition()
289 zone->wp = zone->start; in zonefs_check_zone_condition()
294 * zone is found during mount, the file size cannot be retrieved in zonefs_check_zone_condition()
295 * so we treat the zone as offline (mount == true case). in zonefs_check_zone_condition()
298 * always disabled for the zone. in zonefs_check_zone_condition()
301 zonefs_warn(inode->i_sb, "inode %lu: read-only zone\n", in zonefs_check_zone_condition()
305 zone->cond = BLK_ZONE_COND_OFFLINE; in zonefs_check_zone_condition()
307 zone->wp = zone->start; in zonefs_check_zone_condition()
318 return (zone->wp - zone->start) << SECTOR_SHIFT; in zonefs_check_zone_condition()
327 static int zonefs_io_error_cb(struct blk_zone *zone, unsigned int idx, in zonefs_io_error_cb() argument
338 * Check the zone condition: if the zone is not "bad" (offline or in zonefs_io_error_cb()
341 * data writen in the zone (data_size). in zonefs_io_error_cb()
343 data_size = zonefs_check_zone_condition(inode, zone, true, false); in zonefs_io_error_cb()
345 if (zone->cond != BLK_ZONE_COND_OFFLINE && in zonefs_io_error_cb()
346 zone->cond != BLK_ZONE_COND_READONLY && in zonefs_io_error_cb()
351 * At this point, we detected either a bad zone or an inconsistency in zonefs_io_error_cb()
352 * between the inode size and the amount of data written in the zone. in zonefs_io_error_cb()
355 * 1) The inode size is lower than the amount of data in the zone: in zonefs_io_error_cb()
359 * 2) The inode size is larger than the amount of data in the zone: in zonefs_io_error_cb()
363 * e.g. an application reset the zone directly, or (b) the device in zonefs_io_error_cb()
367 * IO error according to the zone condition and to the mount options. in zonefs_io_error_cb()
375 * errors=zone-ro and errors=zone-offline result in changing the in zonefs_io_error_cb()
376 * zone condition to read-only and offline respectively, as if the in zonefs_io_error_cb()
379 if (zone->cond == BLK_ZONE_COND_OFFLINE || in zonefs_io_error_cb()
383 if (zone->cond != BLK_ZONE_COND_OFFLINE) { in zonefs_io_error_cb()
384 zone->cond = BLK_ZONE_COND_OFFLINE; in zonefs_io_error_cb()
385 data_size = zonefs_check_zone_condition(inode, zone, in zonefs_io_error_cb()
388 } else if (zone->cond == BLK_ZONE_COND_READONLY || in zonefs_io_error_cb()
392 if (zone->cond != BLK_ZONE_COND_READONLY) { in zonefs_io_error_cb()
393 zone->cond = BLK_ZONE_COND_READONLY; in zonefs_io_error_cb()
394 data_size = zonefs_check_zone_condition(inode, zone, in zonefs_io_error_cb()
405 * need to clear the ZONEFS_ZONE_OPEN flag if the zone transitioned to in zonefs_io_error_cb()
407 * close of the zone when the inode file is closed. in zonefs_io_error_cb()
410 (zone->cond == BLK_ZONE_COND_OFFLINE || in zonefs_io_error_cb()
411 zone->cond == BLK_ZONE_COND_READONLY)) in zonefs_io_error_cb()
435 * When an file IO error occurs, check the file zone to see if there is a change
436 * in the zone condition (e.g. offline or read-only). For a failed write to a
437 * sequential zone, the zone write pointer position must also be checked to
455 * The only files that have more than one zone are conventional zone in __zonefs_io_error()
456 * files with aggregated conventional zones, for which the inode zone in __zonefs_io_error()
457 * size is always larger than the device zone size. in __zonefs_io_error()
475 zonefs_err(sb, "Get inode %lu zone information failed %d\n", in __zonefs_io_error()
497 * Only sequential zone files can be truncated and truncation is allowed in zonefs_file_truncate()
498 * only down to a 0 size, which is equivalent to a zone reset, and to in zonefs_file_truncate()
499 * the maximum file size, which is equivalent to a zone finish. in zonefs_file_truncate()
533 * Truncating a zone to EMPTY or FULL is the equivalent of in zonefs_file_truncate()
534 * closing the zone. For a truncation to 0, we need to in zonefs_file_truncate()
535 * re-open the zone to ensure new writes can be processed. in zonefs_file_truncate()
536 * For a truncation to the maximum file size, the zone is in zonefs_file_truncate()
572 * files by zone type. in zonefs_inode_setattr()
613 * flush is needed only for conventional zone files. in zonefs_file_fsync()
648 * Sanity check: only conventional zone files can have shared in zonefs_filemap_page_mkwrite()
676 * shared writable mappings. For sequential zone files, only read in zonefs_file_mmap()
695 * Seeks are limited to below the zone size for conventional zones in zonefs_file_llseek()
696 * and below the zone write pointer for sequential zones. In both in zonefs_file_llseek()
780 * If the file zone was written underneath the file system, the zone in zonefs_file_dio_append()
781 * write pointer may not be where we expect it to be, but the zone in zonefs_file_dio_append()
791 "Corrupted write pointer %llu for zone at %llu\n", in zonefs_file_dio_append()
812 * Do not exceed the LFS limits nor the file zone size. If pos is under the
874 * Handle direct writes. For sequential zone files, this is the only possible
893 * For async direct IOs to sequential zone files, refuse IOCB_NOWAIT in zonefs_file_dio_write()
959 * Direct IO writes are mandatory for sequential zone files so that the in zonefs_file_buffered_write()
1000 /* Write operations beyond the zone size are not allowed */ in zonefs_file_write_iter()
1159 * If the file zone is full, it is not open anymore and we only in zonefs_close_zone()
1170 * where most zones cannot be written (zone resources in zonefs_close_zone()
1176 zonefs_warn(sb, "closing zone failed, remounting filesystem read-only\n"); in zonefs_close_zone()
1190 * If we explicitly open a zone we must close it again as well, but the in zonefs_file_release()
1191 * zone management operation can fail (either due to an IO error or as in zonefs_file_release()
1192 * the zone has gone offline or read-only). Make sure we don't fail the in zonefs_file_release()
1283 { Opt_errors_zro, "errors=zone-ro"},
1284 { Opt_errors_zol, "errors=zone-offline"},
1341 seq_puts(seq, ",errors=zone-ro"); in zonefs_show_options()
1343 seq_puts(seq, ",errors=zone-offline"); in zonefs_show_options()
1383 static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone, in zonefs_init_file_inode() argument
1391 inode->i_ino = zone->start >> sbi->s_zone_sectors_shift; in zonefs_init_file_inode()
1395 zi->i_zsector = zone->start; in zonefs_init_file_inode()
1396 zi->i_zone_size = zone->len << SECTOR_SHIFT; in zonefs_init_file_inode()
1400 "zone size %llu doesn't match device's zone sectors %llu\n", in zonefs_init_file_inode()
1407 zone->capacity << SECTOR_SHIFT); in zonefs_init_file_inode()
1408 zi->i_wpoffset = zonefs_check_zone_condition(inode, zone, true, true); in zonefs_init_file_inode()
1424 * For sequential zones, make sure that any open zone is closed first in zonefs_init_file_inode()
1426 * the open zone accounting done when the mount option in zonefs_init_file_inode()
1430 (zone->cond == BLK_ZONE_COND_IMP_OPEN || in zonefs_init_file_inode()
1431 zone->cond == BLK_ZONE_COND_EXP_OPEN)) { in zonefs_init_file_inode()
1441 const char *name, struct blk_zone *zone, in zonefs_create_inode() argument
1458 if (zone) { in zonefs_create_inode()
1459 ret = zonefs_init_file_inode(inode, zone, type); in zonefs_create_inode()
1486 * Create a zone group and populate it with zone files.
1493 struct blk_zone *zone, *next, *end; in zonefs_create_zgroup() local
1520 * The first zone contains the super block: skip it. in zonefs_create_zgroup()
1523 for (zone = &zd->zones[1]; zone < end; zone = next) { in zonefs_create_zgroup()
1525 next = zone + 1; in zonefs_create_zgroup()
1526 if (zonefs_zone_type(zone) != type) in zonefs_create_zgroup()
1532 * length of the first zone of the set of contiguous zones in zonefs_create_zgroup()
1533 * aggregated together. If one offline or read-only zone is in zonefs_create_zgroup()
1542 zone->len += next->len; in zonefs_create_zgroup()
1543 zone->capacity += next->capacity; in zonefs_create_zgroup()
1545 zone->cond != BLK_ZONE_COND_OFFLINE) in zonefs_create_zgroup()
1546 zone->cond = BLK_ZONE_COND_READONLY; in zonefs_create_zgroup()
1548 zone->cond = BLK_ZONE_COND_OFFLINE; in zonefs_create_zgroup()
1550 if (zone->capacity != zone->len) { in zonefs_create_zgroup()
1551 zonefs_err(sb, "Invalid conventional zone capacity\n"); in zonefs_create_zgroup()
1561 dent = zonefs_create_inode(dir, file_name, zone, type); in zonefs_create_zgroup()
1570 zonefs_info(sb, "Zone group \"%s\" has %u file%s\n", in zonefs_create_zgroup()
1582 static int zonefs_get_zone_info_cb(struct blk_zone *zone, unsigned int idx, in zonefs_get_zone_info_cb() argument
1588 * Count the number of usable zones: the first zone at index 0 contains in zonefs_get_zone_info_cb()
1591 switch (zone->type) { in zonefs_get_zone_info_cb()
1593 zone->wp = zone->start + zone->len; in zonefs_get_zone_info_cb()
1603 zonefs_err(zd->sb, "Unsupported zone type 0x%x\n", in zonefs_get_zone_info_cb()
1604 zone->type); in zonefs_get_zone_info_cb()
1608 memcpy(&zd->zones[idx], zone, sizeof(struct blk_zone)); in zonefs_get_zone_info_cb()
1627 zonefs_err(zd->sb, "Zone report failed %d\n", ret); in zonefs_get_zone_info()
1632 zonefs_err(zd->sb, "Invalid zone report (%d/%u zones)\n", in zonefs_get_zone_info()
1733 * sub-directories and files according to the device zone configuration and
1751 * when the zone files are created so that the format option in zonefs_fill_super()
1753 * beyond the zone size is taken into account. in zonefs_fill_super()
1821 /* Create and populate files in zone groups directories */ in zonefs_fill_super()
1908 MODULE_DESCRIPTION("Zone file system for zoned block devices");