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 'for-6.18-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:

- fix new inode name tracking in tree-log

- fix conventional zone and stripe calculations in zoned mode

- fix bio reference counts on error paths in relocation and scrub

* tag 'for-6.18-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: release root after error in data_reloc_print_warning_inode()
btrfs: scrub: put bio after errors in scrub_raid56_parity_stripe()
btrfs: do not update last_log_commit when logging inode due to a new name
btrfs: zoned: fix stripe width calculation
btrfs: zoned: fix conventional zone capacity calculation

+34 -34
+3 -1
fs/btrfs/inode.c
··· 177 177 return ret; 178 178 } 179 179 ret = paths_from_inode(inum, ipath); 180 - if (ret < 0) 180 + if (ret < 0) { 181 + btrfs_put_root(local_root); 181 182 goto err; 183 + } 182 184 183 185 /* 184 186 * We deliberately ignore the bit ipath might have been too small to
+2
fs/btrfs/scrub.c
··· 2203 2203 ret = btrfs_map_block(fs_info, BTRFS_MAP_WRITE, full_stripe_start, 2204 2204 &length, &bioc, NULL, NULL); 2205 2205 if (ret < 0) { 2206 + bio_put(bio); 2206 2207 btrfs_put_bioc(bioc); 2207 2208 btrfs_bio_counter_dec(fs_info); 2208 2209 goto out; ··· 2213 2212 btrfs_put_bioc(bioc); 2214 2213 if (!rbio) { 2215 2214 ret = -ENOMEM; 2215 + bio_put(bio); 2216 2216 btrfs_bio_counter_dec(fs_info); 2217 2217 goto out; 2218 2218 }
+1 -1
fs/btrfs/tree-log.c
··· 7122 7122 * a power failure unless the log was synced as part of an fsync 7123 7123 * against any other unrelated inode. 7124 7124 */ 7125 - if (inode_only != LOG_INODE_EXISTS) 7125 + if (!ctx->logging_new_name && inode_only != LOG_INODE_EXISTS) 7126 7126 inode->last_log_commit = inode->last_sub_trans; 7127 7127 spin_unlock(&inode->lock); 7128 7128
+28 -32
fs/btrfs/zoned.c
··· 1317 1317 if (!btrfs_dev_is_sequential(device, info->physical)) { 1318 1318 up_read(&dev_replace->rwsem); 1319 1319 info->alloc_offset = WP_CONVENTIONAL; 1320 + info->capacity = device->zone_info->zone_size; 1320 1321 return 0; 1321 1322 } 1322 1323 ··· 1523 1522 u64 last_alloc) 1524 1523 { 1525 1524 struct btrfs_fs_info *fs_info = bg->fs_info; 1525 + u64 stripe_nr = 0, stripe_offset = 0; 1526 + u32 stripe_index = 0; 1526 1527 1527 1528 if ((map->type & BTRFS_BLOCK_GROUP_DATA) && !fs_info->stripe_root) { 1528 1529 btrfs_err(fs_info, "zoned: data %s needs raid-stripe-tree", ··· 1532 1529 return -EINVAL; 1533 1530 } 1534 1531 1532 + if (last_alloc) { 1533 + u32 factor = map->num_stripes; 1534 + 1535 + stripe_nr = last_alloc >> BTRFS_STRIPE_LEN_SHIFT; 1536 + stripe_offset = last_alloc & BTRFS_STRIPE_LEN_MASK; 1537 + stripe_nr = div_u64_rem(stripe_nr, factor, &stripe_index); 1538 + } 1539 + 1535 1540 for (int i = 0; i < map->num_stripes; i++) { 1536 1541 if (zone_info[i].alloc_offset == WP_MISSING_DEV) 1537 1542 continue; 1538 1543 1539 1544 if (zone_info[i].alloc_offset == WP_CONVENTIONAL) { 1540 - u64 stripe_nr, full_stripe_nr; 1541 - u64 stripe_offset; 1542 - int stripe_index; 1543 1545 1544 - stripe_nr = div64_u64(last_alloc, map->stripe_size); 1545 - stripe_offset = stripe_nr * map->stripe_size; 1546 - full_stripe_nr = div_u64(stripe_nr, map->num_stripes); 1547 - div_u64_rem(stripe_nr, map->num_stripes, &stripe_index); 1548 - 1549 - zone_info[i].alloc_offset = 1550 - full_stripe_nr * map->stripe_size; 1546 + zone_info[i].alloc_offset = btrfs_stripe_nr_to_offset(stripe_nr); 1551 1547 1552 1548 if (stripe_index > i) 1553 - zone_info[i].alloc_offset += map->stripe_size; 1549 + zone_info[i].alloc_offset += BTRFS_STRIPE_LEN; 1554 1550 else if (stripe_index == i) 1555 - zone_info[i].alloc_offset += 1556 - (last_alloc - stripe_offset); 1551 + zone_info[i].alloc_offset += stripe_offset; 1557 1552 } 1558 1553 1559 1554 if (test_bit(0, active) != test_bit(i, active)) { ··· 1575 1574 u64 last_alloc) 1576 1575 { 1577 1576 struct btrfs_fs_info *fs_info = bg->fs_info; 1577 + u64 stripe_nr = 0, stripe_offset = 0; 1578 + u32 stripe_index = 0; 1578 1579 1579 1580 if ((map->type & BTRFS_BLOCK_GROUP_DATA) && !fs_info->stripe_root) { 1580 1581 btrfs_err(fs_info, "zoned: data %s needs raid-stripe-tree", 1581 1582 btrfs_bg_type_to_raid_name(map->type)); 1582 1583 return -EINVAL; 1584 + } 1585 + 1586 + if (last_alloc) { 1587 + u32 factor = map->num_stripes / map->sub_stripes; 1588 + 1589 + stripe_nr = last_alloc >> BTRFS_STRIPE_LEN_SHIFT; 1590 + stripe_offset = last_alloc & BTRFS_STRIPE_LEN_MASK; 1591 + stripe_nr = div_u64_rem(stripe_nr, factor, &stripe_index); 1583 1592 } 1584 1593 1585 1594 for (int i = 0; i < map->num_stripes; i++) { ··· 1605 1594 } 1606 1595 1607 1596 if (zone_info[i].alloc_offset == WP_CONVENTIONAL) { 1608 - u64 stripe_nr, full_stripe_nr; 1609 - u64 stripe_offset; 1610 - int stripe_index; 1611 - 1612 - stripe_nr = div64_u64(last_alloc, map->stripe_size); 1613 - stripe_offset = stripe_nr * map->stripe_size; 1614 - full_stripe_nr = div_u64(stripe_nr, 1615 - map->num_stripes / map->sub_stripes); 1616 - div_u64_rem(stripe_nr, 1617 - (map->num_stripes / map->sub_stripes), 1618 - &stripe_index); 1619 - 1620 - zone_info[i].alloc_offset = 1621 - full_stripe_nr * map->stripe_size; 1597 + zone_info[i].alloc_offset = btrfs_stripe_nr_to_offset(stripe_nr); 1622 1598 1623 1599 if (stripe_index > (i / map->sub_stripes)) 1624 - zone_info[i].alloc_offset += map->stripe_size; 1600 + zone_info[i].alloc_offset += BTRFS_STRIPE_LEN; 1625 1601 else if (stripe_index == (i / map->sub_stripes)) 1626 - zone_info[i].alloc_offset += 1627 - (last_alloc - stripe_offset); 1602 + zone_info[i].alloc_offset += stripe_offset; 1628 1603 } 1629 1604 1630 1605 if ((i % map->sub_stripes) == 0) { ··· 1680 1683 set_bit(BLOCK_GROUP_FLAG_SEQUENTIAL_ZONE, &cache->runtime_flags); 1681 1684 1682 1685 if (num_conventional > 0) { 1683 - /* Zone capacity is always zone size in emulation */ 1684 - cache->zone_capacity = cache->length; 1685 1686 ret = calculate_alloc_pointer(cache, &last_alloc, new); 1686 1687 if (ret) { 1687 1688 btrfs_err(fs_info, ··· 1688 1693 goto out; 1689 1694 } else if (map->num_stripes == num_conventional) { 1690 1695 cache->alloc_offset = last_alloc; 1696 + cache->zone_capacity = cache->length; 1691 1697 set_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &cache->runtime_flags); 1692 1698 goto out; 1693 1699 }