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()
401 * need to clear the ZONEFS_ZONE_OPEN flag if the zone transitioned to in zonefs_io_error_cb()
403 * close of the zone when the inode file is closed. in zonefs_io_error_cb()
406 (zone->cond == BLK_ZONE_COND_OFFLINE || in zonefs_io_error_cb()
407 zone->cond == BLK_ZONE_COND_READONLY)) in zonefs_io_error_cb()
431 * When an file IO error occurs, check the file zone to see if there is a change
432 * in the zone condition (e.g. offline or read-only). For a failed write to a
433 * sequential zone, the zone write pointer position must also be checked to
451 * The only files that have more than one zone are conventional zone in __zonefs_io_error()
452 * files with aggregated conventional zones, for which the inode zone in __zonefs_io_error()
453 * size is always larger than the device zone size. in __zonefs_io_error()
471 zonefs_err(sb, "Get inode %lu zone information failed %d\n", in __zonefs_io_error()
493 * Only sequential zone files can be truncated and truncation is allowed in zonefs_file_truncate()
494 * only down to a 0 size, which is equivalent to a zone reset, and to in zonefs_file_truncate()
495 * the maximum file size, which is equivalent to a zone finish. in zonefs_file_truncate()
529 * Truncating a zone to EMPTY or FULL is the equivalent of in zonefs_file_truncate()
530 * closing the zone. For a truncation to 0, we need to in zonefs_file_truncate()
531 * re-open the zone to ensure new writes can be processed. in zonefs_file_truncate()
532 * For a truncation to the maximum file size, the zone is in zonefs_file_truncate()
568 * files by zone type. in zonefs_inode_setattr()
609 * flush is needed only for conventional zone files. in zonefs_file_fsync()
644 * Sanity check: only conventional zone files can have shared in zonefs_filemap_page_mkwrite()
672 * shared writable mappings. For sequential zone files, only read in zonefs_file_mmap()
691 * Seeks are limited to below the zone size for conventional zones in zonefs_file_llseek()
692 * and below the zone write pointer for sequential zones. In both in zonefs_file_llseek()
790 * Do not exceed the LFS limits nor the file zone size. If pos is under the
852 * Handle direct writes. For sequential zone files, this is the only possible
871 * For async direct IOs to sequential zone files, refuse IOCB_NOWAIT in zonefs_file_dio_write()
937 * Direct IO writes are mandatory for sequential zone files so that the in zonefs_file_buffered_write()
978 /* Write operations beyond the zone size are not allowed */ in zonefs_file_write_iter()
1137 * If the file zone is full, it is not open anymore and we only in zonefs_close_zone()
1148 * where most zones cannot be written (zone resources in zonefs_close_zone()
1154 zonefs_warn(sb, "closing zone failed, remounting filesystem read-only\n"); in zonefs_close_zone()
1168 * If we explicitly open a zone we must close it again as well, but the in zonefs_file_release()
1169 * zone management operation can fail (either due to an IO error or as in zonefs_file_release()
1170 * the zone has gone offline or read-only). Make sure we don't fail the in zonefs_file_release()
1261 { Opt_errors_zro, "errors=zone-ro"},
1262 { Opt_errors_zol, "errors=zone-offline"},
1319 seq_puts(seq, ",errors=zone-ro"); in zonefs_show_options()
1321 seq_puts(seq, ",errors=zone-offline"); in zonefs_show_options()
1361 static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone, in zonefs_init_file_inode() argument
1369 inode->i_ino = zone->start >> sbi->s_zone_sectors_shift; in zonefs_init_file_inode()
1373 zi->i_zsector = zone->start; in zonefs_init_file_inode()
1374 zi->i_zone_size = zone->len << SECTOR_SHIFT; in zonefs_init_file_inode()
1378 "zone size %llu doesn't match device's zone sectors %llu\n", in zonefs_init_file_inode()
1385 zone->capacity << SECTOR_SHIFT); in zonefs_init_file_inode()
1386 zi->i_wpoffset = zonefs_check_zone_condition(inode, zone, true, true); in zonefs_init_file_inode()
1402 * For sequential zones, make sure that any open zone is closed first in zonefs_init_file_inode()
1404 * the open zone accounting done when the mount option in zonefs_init_file_inode()
1408 (zone->cond == BLK_ZONE_COND_IMP_OPEN || in zonefs_init_file_inode()
1409 zone->cond == BLK_ZONE_COND_EXP_OPEN)) { in zonefs_init_file_inode()
1419 const char *name, struct blk_zone *zone, in zonefs_create_inode() argument
1436 if (zone) { in zonefs_create_inode()
1437 ret = zonefs_init_file_inode(inode, zone, type); in zonefs_create_inode()
1464 * Create a zone group and populate it with zone files.
1471 struct blk_zone *zone, *next, *end; in zonefs_create_zgroup() local
1498 * The first zone contains the super block: skip it. in zonefs_create_zgroup()
1501 for (zone = &zd->zones[1]; zone < end; zone = next) { in zonefs_create_zgroup()
1503 next = zone + 1; in zonefs_create_zgroup()
1504 if (zonefs_zone_type(zone) != type) in zonefs_create_zgroup()
1510 * length of the first zone of the set of contiguous zones in zonefs_create_zgroup()
1511 * aggregated together. If one offline or read-only zone is in zonefs_create_zgroup()
1520 zone->len += next->len; in zonefs_create_zgroup()
1521 zone->capacity += next->capacity; in zonefs_create_zgroup()
1523 zone->cond != BLK_ZONE_COND_OFFLINE) in zonefs_create_zgroup()
1524 zone->cond = BLK_ZONE_COND_READONLY; in zonefs_create_zgroup()
1526 zone->cond = BLK_ZONE_COND_OFFLINE; in zonefs_create_zgroup()
1528 if (zone->capacity != zone->len) { in zonefs_create_zgroup()
1529 zonefs_err(sb, "Invalid conventional zone capacity\n"); in zonefs_create_zgroup()
1539 dent = zonefs_create_inode(dir, file_name, zone, type); in zonefs_create_zgroup()
1548 zonefs_info(sb, "Zone group \"%s\" has %u file%s\n", in zonefs_create_zgroup()
1560 static int zonefs_get_zone_info_cb(struct blk_zone *zone, unsigned int idx, in zonefs_get_zone_info_cb() argument
1566 * Count the number of usable zones: the first zone at index 0 contains in zonefs_get_zone_info_cb()
1569 switch (zone->type) { in zonefs_get_zone_info_cb()
1571 zone->wp = zone->start + zone->len; in zonefs_get_zone_info_cb()
1581 zonefs_err(zd->sb, "Unsupported zone type 0x%x\n", in zonefs_get_zone_info_cb()
1582 zone->type); in zonefs_get_zone_info_cb()
1586 memcpy(&zd->zones[idx], zone, sizeof(struct blk_zone)); in zonefs_get_zone_info_cb()
1605 zonefs_err(zd->sb, "Zone report failed %d\n", ret); in zonefs_get_zone_info()
1610 zonefs_err(zd->sb, "Invalid zone report (%d/%u zones)\n", in zonefs_get_zone_info()
1711 * sub-directories and files according to the device zone configuration and
1729 * when the zone files are created so that the format option in zonefs_fill_super()
1731 * beyond the zone size is taken into account. in zonefs_fill_super()
1799 /* Create and populate files in zone groups directories */ in zonefs_fill_super()
1886 MODULE_DESCRIPTION("Zone file system for zoned block devices");