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.

Merge tag 'zonefs-6.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs

Pull zonefs fixes from Damien Le Moal:

- Fix the IO error recovery path for failures happening in the last
zone of device, and that zone is a "runt" zone (smaller than the
other zone). The current code was failing to properly obtain a zone
report in that case.

- Remove the unused to_attr() function as it is unused, causing
compilation warnings with clang.

* tag 'zonefs-6.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
zonefs: Remove to_attr() helper function
zonefs: fix zone report size in __zonefs_io_error()

+27 -15
+27 -10
fs/zonefs/super.c
··· 478 478 struct super_block *sb = inode->i_sb; 479 479 struct zonefs_sb_info *sbi = ZONEFS_SB(sb); 480 480 unsigned int noio_flag; 481 - unsigned int nr_zones = 482 - zi->i_zone_size >> (sbi->s_zone_sectors_shift + SECTOR_SHIFT); 481 + unsigned int nr_zones = 1; 483 482 struct zonefs_ioerr_data err = { 484 483 .inode = inode, 485 484 .write = write, 486 485 }; 487 486 int ret; 487 + 488 + /* 489 + * The only files that have more than one zone are conventional zone 490 + * files with aggregated conventional zones, for which the inode zone 491 + * size is always larger than the device zone size. 492 + */ 493 + if (zi->i_zone_size > bdev_zone_sectors(sb->s_bdev)) 494 + nr_zones = zi->i_zone_size >> 495 + (sbi->s_zone_sectors_shift + SECTOR_SHIFT); 488 496 489 497 /* 490 498 * Memory allocations in blkdev_report_zones() can trigger a memory ··· 1415 1407 zi->i_ztype = type; 1416 1408 zi->i_zsector = zone->start; 1417 1409 zi->i_zone_size = zone->len << SECTOR_SHIFT; 1410 + if (zi->i_zone_size > bdev_zone_sectors(sb->s_bdev) << SECTOR_SHIFT && 1411 + !(sbi->s_features & ZONEFS_F_AGGRCNV)) { 1412 + zonefs_err(sb, 1413 + "zone size %llu doesn't match device's zone sectors %llu\n", 1414 + zi->i_zone_size, 1415 + bdev_zone_sectors(sb->s_bdev) << SECTOR_SHIFT); 1416 + return -EINVAL; 1417 + } 1418 1418 1419 1419 zi->i_max_size = min_t(loff_t, MAX_LFS_FILESIZE, 1420 1420 zone->capacity << SECTOR_SHIFT); ··· 1472 1456 struct inode *dir = d_inode(parent); 1473 1457 struct dentry *dentry; 1474 1458 struct inode *inode; 1475 - int ret; 1459 + int ret = -ENOMEM; 1476 1460 1477 1461 dentry = d_alloc_name(parent, name); 1478 1462 if (!dentry) 1479 - return NULL; 1463 + return ERR_PTR(ret); 1480 1464 1481 1465 inode = new_inode(parent->d_sb); 1482 1466 if (!inode) ··· 1501 1485 dput: 1502 1486 dput(dentry); 1503 1487 1504 - return NULL; 1488 + return ERR_PTR(ret); 1505 1489 } 1506 1490 1507 1491 struct zonefs_zone_data { ··· 1521 1505 struct blk_zone *zone, *next, *end; 1522 1506 const char *zgroup_name; 1523 1507 char *file_name; 1524 - struct dentry *dir; 1508 + struct dentry *dir, *dent; 1525 1509 unsigned int n = 0; 1526 1510 int ret; 1527 1511 ··· 1539 1523 zgroup_name = "seq"; 1540 1524 1541 1525 dir = zonefs_create_inode(sb->s_root, zgroup_name, NULL, type); 1542 - if (!dir) { 1543 - ret = -ENOMEM; 1526 + if (IS_ERR(dir)) { 1527 + ret = PTR_ERR(dir); 1544 1528 goto free; 1545 1529 } 1546 1530 ··· 1586 1570 * Use the file number within its group as file name. 1587 1571 */ 1588 1572 snprintf(file_name, ZONEFS_NAME_MAX - 1, "%u", n); 1589 - if (!zonefs_create_inode(dir, file_name, zone, type)) { 1590 - ret = -ENOMEM; 1573 + dent = zonefs_create_inode(dir, file_name, zone, type); 1574 + if (IS_ERR(dent)) { 1575 + ret = PTR_ERR(dent); 1591 1576 goto free; 1592 1577 } 1593 1578
-5
fs/zonefs/sysfs.c
··· 15 15 ssize_t (*show)(struct zonefs_sb_info *sbi, char *buf); 16 16 }; 17 17 18 - static inline struct zonefs_sysfs_attr *to_attr(struct attribute *attr) 19 - { 20 - return container_of(attr, struct zonefs_sysfs_attr, attr); 21 - } 22 - 23 18 #define ZONEFS_SYSFS_ATTR_RO(name) \ 24 19 static struct zonefs_sysfs_attr zonefs_sysfs_attr_##name = __ATTR_RO(name) 25 20