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

Merge tag 'for-6.11-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:

- fix double inode unlock for direct IO sync writes (reported by
syzbot)

- fix root tree id/name map definitions, don't use fixed size buffers
for name (reported by -Werror=unterminated-string-initialization)

- fix qgroup reserve leaks in bufferd write path

- update scrub status structure more often so it can be reported in
user space more accurately and let 'resume' not repeat work

- in preparation to remove space cache v1 in the future print a warning
if it's detected

* tag 'for-6.11-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: avoid using fixed char array size for tree names
btrfs: fix double inode unlock for direct IO sync writes
btrfs: emit a warning about space cache v1 being deprecated
btrfs: fix qgroup reserve leaks in cow_file_range
btrfs: implement launder_folio for clearing dirty page reserve
btrfs: scrub: update last_physical after scrubbing one stripe
btrfs: factor out stripe length calculation into a helper

+38 -9
+4 -1
fs/btrfs/file.c
··· 1868 1868 1869 1869 out_release_extents: 1870 1870 btrfs_release_log_ctx_extents(&ctx); 1871 - btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP); 1871 + if (skip_ilock) 1872 + up_write(&inode->i_mmap_lock); 1873 + else 1874 + btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP); 1872 1875 goto out; 1873 1876 } 1874 1877
+10
fs/btrfs/inode.c
··· 1585 1585 locked_page, &cached, 1586 1586 clear_bits, 1587 1587 page_ops); 1588 + btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL); 1588 1589 start += cur_alloc_size; 1589 1590 } 1590 1591 ··· 1599 1598 clear_bits |= EXTENT_CLEAR_DATA_RESV; 1600 1599 extent_clear_unlock_delalloc(inode, start, end, locked_page, 1601 1600 &cached, clear_bits, page_ops); 1601 + btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL); 1602 1602 } 1603 1603 return ret; 1604 1604 } ··· 2261 2259 EXTENT_DO_ACCOUNTING, PAGE_UNLOCK | 2262 2260 PAGE_START_WRITEBACK | 2263 2261 PAGE_END_WRITEBACK); 2262 + btrfs_qgroup_free_data(inode, NULL, cur_offset, end - cur_offset + 1, NULL); 2264 2263 } 2265 2264 btrfs_free_path(path); 2266 2265 return ret; ··· 7205 7202 spin_unlock_irq(&subpage->lock); 7206 7203 } 7207 7204 7205 + static int btrfs_launder_folio(struct folio *folio) 7206 + { 7207 + return btrfs_qgroup_free_data(folio_to_inode(folio), NULL, folio_pos(folio), 7208 + PAGE_SIZE, NULL); 7209 + } 7210 + 7208 7211 static bool __btrfs_release_folio(struct folio *folio, gfp_t gfp_flags) 7209 7212 { 7210 7213 if (try_release_extent_mapping(&folio->page, gfp_flags)) { ··· 10146 10137 .writepages = btrfs_writepages, 10147 10138 .readahead = btrfs_readahead, 10148 10139 .invalidate_folio = btrfs_invalidate_folio, 10140 + .launder_folio = btrfs_launder_folio, 10149 10141 .release_folio = btrfs_release_folio, 10150 10142 .migrate_folio = btrfs_migrate_folio, 10151 10143 .dirty_folio = filemap_dirty_folio,
+1 -1
fs/btrfs/print-tree.c
··· 14 14 15 15 struct root_name_map { 16 16 u64 id; 17 - char name[16]; 17 + const char *name; 18 18 }; 19 19 20 20 static const struct root_name_map root_map[] = {
+19 -6
fs/btrfs/scrub.c
··· 1648 1648 } 1649 1649 } 1650 1650 1651 + static u32 stripe_length(const struct scrub_stripe *stripe) 1652 + { 1653 + ASSERT(stripe->bg); 1654 + 1655 + return min(BTRFS_STRIPE_LEN, 1656 + stripe->bg->start + stripe->bg->length - stripe->logical); 1657 + } 1658 + 1651 1659 static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx, 1652 1660 struct scrub_stripe *stripe) 1653 1661 { 1654 1662 struct btrfs_fs_info *fs_info = stripe->bg->fs_info; 1655 1663 struct btrfs_bio *bbio = NULL; 1656 - unsigned int nr_sectors = min(BTRFS_STRIPE_LEN, stripe->bg->start + 1657 - stripe->bg->length - stripe->logical) >> 1658 - fs_info->sectorsize_bits; 1664 + unsigned int nr_sectors = stripe_length(stripe) >> fs_info->sectorsize_bits; 1659 1665 u64 stripe_len = BTRFS_STRIPE_LEN; 1660 1666 int mirror = stripe->mirror_num; 1661 1667 int i; ··· 1735 1729 { 1736 1730 struct btrfs_fs_info *fs_info = sctx->fs_info; 1737 1731 struct btrfs_bio *bbio; 1738 - unsigned int nr_sectors = min(BTRFS_STRIPE_LEN, stripe->bg->start + 1739 - stripe->bg->length - stripe->logical) >> 1740 - fs_info->sectorsize_bits; 1732 + unsigned int nr_sectors = stripe_length(stripe) >> fs_info->sectorsize_bits; 1741 1733 int mirror = stripe->mirror_num; 1742 1734 1743 1735 ASSERT(stripe->bg); ··· 1875 1871 stripe = &sctx->stripes[i]; 1876 1872 1877 1873 wait_scrub_stripe_io(stripe); 1874 + spin_lock(&sctx->stat_lock); 1875 + sctx->stat.last_physical = stripe->physical + stripe_length(stripe); 1876 + spin_unlock(&sctx->stat_lock); 1878 1877 scrub_reset_stripe(stripe); 1879 1878 } 1880 1879 out: ··· 2146 2139 cur_physical, &found_logical); 2147 2140 if (ret > 0) { 2148 2141 /* No more extent, just update the accounting */ 2142 + spin_lock(&sctx->stat_lock); 2149 2143 sctx->stat.last_physical = physical + logical_length; 2144 + spin_unlock(&sctx->stat_lock); 2150 2145 ret = 0; 2151 2146 break; 2152 2147 } ··· 2345 2336 stripe_logical += chunk_logical; 2346 2337 ret = scrub_raid56_parity_stripe(sctx, scrub_dev, bg, 2347 2338 map, stripe_logical); 2339 + spin_lock(&sctx->stat_lock); 2340 + sctx->stat.last_physical = min(physical + BTRFS_STRIPE_LEN, 2341 + physical_end); 2342 + spin_unlock(&sctx->stat_lock); 2348 2343 if (ret) 2349 2344 goto out; 2350 2345 goto next;
+4 -1
fs/btrfs/super.c
··· 683 683 ret = false; 684 684 685 685 if (!test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state)) { 686 - if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE)) 686 + if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE)) { 687 687 btrfs_info(info, "disk space caching is enabled"); 688 + btrfs_warn(info, 689 + "space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2"); 690 + } 688 691 if (btrfs_raw_test_opt(*mount_opt, FREE_SPACE_TREE)) 689 692 btrfs_info(info, "using free-space-tree"); 690 693 }