]> Git Repo - J-linux.git/commitdiff
Merge tag 'for-6.11-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
authorLinus Torvalds <[email protected]>
Wed, 17 Jul 2024 19:38:04 +0000 (12:38 -0700)
committerLinus Torvalds <[email protected]>
Wed, 17 Jul 2024 19:38:04 +0000 (12:38 -0700)
Pull btrfs updates from David Sterba:
 "The highlights are new logic behind background block group reclaim,
  automatic removal of qgroup after removing a subvolume and new
  'rescue=' mount options.

  The rest is optimizations, cleanups and refactoring.

  User visible features:

   - dynamic block group reclaim:
      - tunable framework to avoid situations where eager data
        allocations prevent creating new metadata chunks due to lack of
        unallocated space
      - reuse sysfs knob bg_reclaim_threshold (otherwise used only in
        zoned mode) for a fixed value threshold
      - new on/off sysfs knob "dynamic_reclaim" calculating the value
        based on heuristics, aiming to keep spare working space for
        relocating chunks but not to needlessly relocate partially
        utilized block groups or reclaim newly allocated ones
      - stats are exported in sysfs per block group type, files
        "reclaim_*"
      - this may increase IO load at unexpected times but the corner
        case of no allocatable block groups is known to be worse

   - automatically remove qgroup of deleted subvolumes:
      - adjust qgroup removal conditions, make sure all related
        subvolume data are already removed, or return EBUSY, also take
        into account setting of sysfs drop_subtree_threshold
      - also works in squota mode

   - mount option updates: new modes of 'rescue=' that allow to mount
     images (read-only) that could have been partially converted by user
     space tools
      - ignoremetacsums  - invalid metadata checksums are ignored
      - ignoresuperflags - super block flags that track conversion in
                           progress (like UUID or checksums)

  Core:

   - size of struct btrfs_inode is now below 1024 (on a release config),
     improved memory packing and other secondary effects

   - switch tracking of open inodes from rb-tree to xarray, minor
     performance improvement

   - reduce number of empty transaction commits when there are no dirty
     data/metadata

   - memory allocation optimizations (reduced numbers, reordering out of
     critical sections)

   - extent map structure optimizations and refactoring, more sanity
     checks

   - more subpage in zoned mode preparations or fixes

   - general snapshot code cleanups, improvements and documentation

   - tree-checker updates: more file extent ram_bytes fixes, continued

   - raid-stripe-tree update (not backward compatible):
      - remove extent encoding field from the structure, can be inferred
        from other information
      - requires btrfs-progs 6.9.1 or newer

   - cleanups and refactoring
      - error message updates
      - error handling improvements
      - return type and parameter cleanups and improvements"

* tag 'for-6.11-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (152 commits)
  btrfs: fix extent map use-after-free when adding pages to compressed bio
  btrfs: fix bitmap leak when loading free space cache on duplicate entry
  btrfs: remove the BUG_ON() inside extent_range_clear_dirty_for_io()
  btrfs: move extent_range_clear_dirty_for_io() into inode.c
  btrfs: enhance compression error messages
  btrfs: fix data race when accessing the last_trans field of a root
  btrfs: rename the extra_gfp parameter of btrfs_alloc_page_array()
  btrfs: remove the extra_gfp parameter from btrfs_alloc_folio_array()
  btrfs: introduce new "rescue=ignoresuperflags" mount option
  btrfs: introduce new "rescue=ignoremetacsums" mount option
  btrfs: output the unrecognized super block flags as hex
  btrfs: remove unused Opt enums
  btrfs: tree-checker: add extra ram_bytes and disk_num_bytes check
  btrfs: fix the ram_bytes assignment for truncated ordered extents
  btrfs: make validate_extent_map() catch ram_bytes mismatch
  btrfs: ignore incorrect btrfs_file_extent_item::ram_bytes
  btrfs: cleanup the bytenr usage inside btrfs_extent_item_to_extent_map()
  btrfs: fix typo in error message in btrfs_validate_super()
  btrfs: move the direct IO code into its own file
  btrfs: pass a btrfs_inode to btrfs_set_prop()
  ...

1  2 
fs/btrfs/disk-io.c
fs/btrfs/extent_map.c
fs/btrfs/fs.h
fs/btrfs/inode.c
fs/btrfs/ioctl.c
include/trace/events/btrfs.h

Simple merge
index b4c9a6aa118cd22f11246fcd45fc032fbccb79b2,6961cc73fe3fc9cfeb98fd5b176869f0455959ae..81558f90ee80fa5c05d5811ab5e79017e6bdb0ec
@@@ -1064,25 -1139,14 +1146,25 @@@ static long btrfs_scan_inode(struct btr
        if (!down_read_trylock(&inode->i_mmap_lock))
                return 0;
  
 -      write_lock(&tree->lock);
 +      /*
 +       * We want to be fast because we can be called from any path trying to
 +       * allocate memory, so if the lock is busy we don't want to spend time
 +       * waiting for it - either some task is about to do IO for the inode or
 +       * we may have another task shrinking extent maps, here in this code, so
 +       * skip this inode.
 +       */
 +      if (!write_trylock(&tree->lock)) {
 +              up_read(&inode->i_mmap_lock);
 +              return 0;
 +      }
 +
-       node = rb_first_cached(&tree->map);
+       node = rb_first(&tree->root);
        while (node) {
+               struct rb_node *next = rb_next(node);
                struct extent_map *em;
  
                em = rb_entry(node, struct extent_map, rb_node);
-               node = rb_next(node);
 -              (*scanned)++;
 +              ctx->scanned++;
  
                if (em->flags & EXTENT_FLAG_PINNED)
                        goto next;
@@@ -1107,14 -1171,14 +1189,15 @@@ next
                        break;
  
                /*
 -               * Restart if we had to reschedule, and any extent maps that were
 -               * pinned before may have become unpinned after we released the
 -               * lock and took it again.
 +               * Stop if we need to reschedule or there's contention on the
 +               * lock. This is to avoid slowing other tasks trying to take the
 +               * lock and because the shrinker might be called during a memory
 +               * allocation path and we want to avoid taking a very long time
 +               * and slowing down all sorts of tasks.
                 */
 -              if (cond_resched_rwlock_write(&tree->lock))
 -                      node = rb_first(&tree->root);
 -              else
 -                      node = next;
 +              if (need_resched() || rwlock_needbreak(&tree->lock))
 +                      break;
++              node = next;
        }
        write_unlock(&tree->lock);
        up_read(&inode->i_mmap_lock);
diff --cc fs/btrfs/fs.h
Simple merge
index d62c96f00ff8157c27a9590ed71949cf56b53e25,8f38eefc8acdd6d44917ee6a280fe2b21c25ec7c..01eab695564727be83101c4b9eecd1a43c1fc908
@@@ -5587,7 -5551,7 +5551,7 @@@ static struct inode *btrfs_iget_locked(
        args.ino = ino;
        args.root = root;
  
-       inode = iget5_locked_rcu(s, hashval, btrfs_find_actor,
 -      inode = iget5_locked(root->fs_info->sb, hashval, btrfs_find_actor,
++      inode = iget5_locked_rcu(root->fs_info->sb, hashval, btrfs_find_actor,
                             btrfs_init_locked_inode,
                             (void *)&args);
        return inode;
Simple merge
Simple merge
This page took 0.1363 seconds and 4 git commands to generate.