Merge tag 'bcachefs-2024-03-13' of https://evilpiepirate.org/git/bcachefs
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Mar 2024 16:00:09 +0000 (09:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Mar 2024 16:00:09 +0000 (09:00 -0700)
Pull bcachefs updates from Kent Overstreet:

 - Subvolume children btree; this is needed for providing a userspace
   interface for walking subvolumes, which will come later

 - Lots of improvements to directory structure checking

 - Improved journal pipelining, significantly improving performance on
   high iodepth write workloads

 - Discard path improvements: the discard path is more efficient, and no
   longer flushes the journal unnecessarily

 - Buffered write path can now avoid taking the inode lock

 - new mm helper: memalloc_flags_{save|restore}

 - mempool now does kvmalloc mempools

* tag 'bcachefs-2024-03-13' of https://evilpiepirate.org/git/bcachefs: (128 commits)
  bcachefs: time_stats: shrink time_stat_buffer for better alignment
  bcachefs: time_stats: split stats-with-quantiles into a separate structure
  bcachefs: mean_and_variance: put struct mean_and_variance_weighted on a diet
  bcachefs: time_stats: add larger units
  bcachefs: pull out time_stats.[ch]
  bcachefs: reconstruct_alloc cleanup
  bcachefs: fix bch_folio_sector padding
  bcachefs: Fix btree key cache coherency during replay
  bcachefs: Always flush write buffer in delete_dead_inodes()
  bcachefs: Fix order of gc_done passes
  bcachefs: fix deletion of indirect extents in btree_gc
  bcachefs: Prefer struct_size over open coded arithmetic
  bcachefs: Kill unused flags argument to btree_split()
  bcachefs: Check for writing superblocks with nonsense member seq fields
  bcachefs: fix bch2_journal_buf_to_text()
  lib/generic-radix-tree.c: Make nodes more reasonably sized
  bcachefs: copy_(to|from)_user_errcode()
  bcachefs: Split out bkey_types.h
  bcachefs: fix lost journal buf wakeup due to improved pipelining
  bcachefs: intercept mountoption value for bool type
  ...

1  2 
MAINTAINERS
fs/bcachefs/super-io.c
fs/inode.c
include/linux/fs.h
include/linux/sched.h
include/linux/sched/mm.h

diff --cc MAINTAINERS
Simple merge
index bd64eb68e84af4c6b7afed028a6bd7d9ae2cc5d6,010daebf987b5b843e217f857279bcd77dd438fe..bceac29f3d86272d884c8fa59ad8e7f7c8163318
@@@ -715,11 -723,12 +723,12 @@@ retry
                        opt_set(*opts, nochanges, true);
        }
  
 -      if (IS_ERR(sb->bdev_handle)) {
 -              ret = PTR_ERR(sb->bdev_handle);
 +      if (IS_ERR(sb->s_bdev_file)) {
 +              ret = PTR_ERR(sb->s_bdev_file);
+               prt_printf(&err, "error opening %s: %s", path, bch2_err_str(ret));
                goto err;
        }
 -      sb->bdev = sb->bdev_handle->bdev;
 +      sb->bdev = file_bdev(sb->s_bdev_file);
  
        ret = bch2_sb_realloc(sb, 0);
        if (ret) {
diff --cc fs/inode.c
Simple merge
Simple merge
Simple merge
index 7a4066d228832a63267f42d94a9b2fa00880e2ed,c29059a760525868d555bf020e5e150c58fac94c..b6543f9d78d6b868f30fff4289c317ae365b8ca1
@@@ -367,81 -388,27 +390,76 @@@ static inline unsigned int memalloc_nof
   */
  static inline void memalloc_nofs_restore(unsigned int flags)
  {
-       current->flags = (current->flags & ~PF_MEMALLOC_NOFS) | flags;
+       memalloc_flags_restore(flags);
  }
  
 +/**
 + * memalloc_noreclaim_save - Marks implicit __GFP_MEMALLOC scope.
 + *
 + * This function marks the beginning of the __GFP_MEMALLOC allocation scope.
 + * All further allocations will implicitly add the __GFP_MEMALLOC flag, which
 + * prevents entering reclaim and allows access to all memory reserves. This
 + * should only be used when the caller guarantees the allocation will allow more
 + * memory to be freed very shortly, i.e. it needs to allocate some memory in
 + * the process of freeing memory, and cannot reclaim due to potential recursion.
 + *
 + * Users of this scope have to be extremely careful to not deplete the reserves
 + * completely and implement a throttling mechanism which controls the
 + * consumption of the reserve based on the amount of freed memory. Usage of a
 + * pre-allocated pool (e.g. mempool) should be always considered before using
 + * this scope.
 + *
 + * Individual allocations under the scope can opt out using __GFP_NOMEMALLOC
 + *
 + * Context: This function should not be used in an interrupt context as that one
 + *          does not give PF_MEMALLOC access to reserves.
 + *          See __gfp_pfmemalloc_flags().
 + * Return: The saved flags to be passed to memalloc_noreclaim_restore.
 + */
  static inline unsigned int memalloc_noreclaim_save(void)
  {
-       unsigned int flags = current->flags & PF_MEMALLOC;
-       current->flags |= PF_MEMALLOC;
-       return flags;
+       return memalloc_flags_save(PF_MEMALLOC);
  }
  
 +/**
 + * memalloc_noreclaim_restore - Ends the implicit __GFP_MEMALLOC scope.
 + * @flags: Flags to restore.
 + *
 + * Ends the implicit __GFP_MEMALLOC scope started by memalloc_noreclaim_save
 + * function. Always make sure that the given flags is the return value from the
 + * pairing memalloc_noreclaim_save call.
 + */
  static inline void memalloc_noreclaim_restore(unsigned int flags)
  {
-       current->flags = (current->flags & ~PF_MEMALLOC) | flags;
+       memalloc_flags_restore(flags);
  }
  
 +/**
 + * memalloc_pin_save - Marks implicit ~__GFP_MOVABLE scope.
 + *
 + * This function marks the beginning of the ~__GFP_MOVABLE allocation scope.
 + * All further allocations will implicitly remove the __GFP_MOVABLE flag, which
 + * will constraint the allocations to zones that allow long term pinning, i.e.
 + * not ZONE_MOVABLE zones.
 + *
 + * Return: The saved flags to be passed to memalloc_pin_restore.
 + */
  static inline unsigned int memalloc_pin_save(void)
  {
-       unsigned int flags = current->flags & PF_MEMALLOC_PIN;
-       current->flags |= PF_MEMALLOC_PIN;
-       return flags;
+       return memalloc_flags_save(PF_MEMALLOC_PIN);
  }
  
 +/**
 + * memalloc_pin_restore - Ends the implicit ~__GFP_MOVABLE scope.
 + * @flags: Flags to restore.
 + *
 + * Ends the implicit ~__GFP_MOVABLE scope started by memalloc_pin_save function.
 + * Always make sure that the given flags is the return value from the pairing
 + * memalloc_pin_save call.
 + */
  static inline void memalloc_pin_restore(unsigned int flags)
  {
-       current->flags = (current->flags & ~PF_MEMALLOC_PIN) | flags;
+       memalloc_flags_restore(flags);
  }
  
  #ifdef CONFIG_MEMCG