The following commit has been merged in the master branch:
commit 2d1373e4246da3b58e1df058374ed6b101804e07
Merge: f338e77383789c0cae23ca3d48adcc5e9e137e3c 
fc1cd1f18c34f91e78362f9629ab9fd43b9dcab9
Author: Linus Torvalds <[email protected]>
Date:   Mon Mar 16 08:53:06 2026 -0700

    Merge tag 'for-7.0-rc4-tag' of 
git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
    
    Pull btrfs fixes from David Sterba:
    
     - fix logging of new dentries when logging parent directory and there
       are conflicting inodes (e.g. deleted directory)
    
     - avoid taking big device lock for zone setup, this is not necessary
       during mount
    
     - tune message verbosity when auto-reclaiming zones when low on space
    
     - fix slightly misleading message of root item check
    
    * tag 'for-7.0-rc4-tag' of 
git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
      btrfs: tree-checker: fix misleading root drop_level error message
      btrfs: log new dentries when logging parent dir of a conflicting inode
      btrfs: don't take device_list_mutex when querying zone info
      btrfs: pass 'verbose' parameter to btrfs_relocate_block_group

diff --combined fs/btrfs/tree-log.c
index 780a06d592409,37c272df52b05..552fef3c385a5
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@@ -5928,7 -5928,7 +5928,7 @@@ again
                        if (ret)
                                goto out;
                        if (ctx->log_new_dentries) {
 -                              dir_elem = kmalloc(sizeof(*dir_elem), GFP_NOFS);
 +                              dir_elem = kmalloc_obj(*dir_elem, GFP_NOFS);
                                if (!dir_elem) {
                                        ret = -ENOMEM;
                                        goto out;
@@@ -6122,7 -6122,7 +6122,7 @@@ static int add_conflicting_inode(struc
                        return ret;
  
                /* Conflicting inode is a directory, so we'll log its parent. */
 -              ino_elem = kmalloc(sizeof(*ino_elem), GFP_NOFS);
 +              ino_elem = kmalloc_obj(*ino_elem, GFP_NOFS);
                if (!ino_elem)
                        return -ENOMEM;
                ino_elem->ino = ino;
@@@ -6180,7 -6180,7 +6180,7 @@@
  
        btrfs_add_delayed_iput(inode);
  
 -      ino_elem = kmalloc(sizeof(*ino_elem), GFP_NOFS);
 +      ino_elem = kmalloc_obj(*ino_elem, GFP_NOFS);
        if (!ino_elem)
                return -ENOMEM;
        ino_elem->ino = ino;
@@@ -6195,6 -6195,7 +6195,7 @@@ static int log_conflicting_inodes(struc
                                  struct btrfs_root *root,
                                  struct btrfs_log_ctx *ctx)
  {
+       const bool orig_log_new_dentries = ctx->log_new_dentries;
        int ret = 0;
  
        /*
@@@ -6256,7 -6257,11 +6257,11 @@@
                         * dir index key range logged for the directory. So we
                         * must make sure the deletion is recorded.
                         */
+                       ctx->log_new_dentries = false;
                        ret = btrfs_log_inode(trans, inode, LOG_INODE_ALL, ctx);
+                       if (!ret && ctx->log_new_dentries)
+                               ret = log_new_dir_dentries(trans, inode, ctx);
+ 
                        btrfs_add_delayed_iput(inode);
                        if (ret)
                                break;
@@@ -6291,6 -6296,7 +6296,7 @@@
                        break;
        }
  
+       ctx->log_new_dentries = orig_log_new_dentries;
        ctx->logging_conflict_inodes = false;
        if (ret)
                free_conflicting_inodes(ctx);
diff --combined fs/btrfs/volumes.c
index 648bb09fc4166,7efc2f7a9bb28..be8975ef8b249
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@@ -382,7 -382,7 +382,7 @@@ static struct btrfs_fs_devices *alloc_f
  {
        struct btrfs_fs_devices *fs_devs;
  
 -      fs_devs = kzalloc(sizeof(*fs_devs), GFP_KERNEL);
 +      fs_devs = kzalloc_obj(*fs_devs);
        if (!fs_devs)
                return ERR_PTR(-ENOMEM);
  
@@@ -3587,7 -3587,7 +3587,7 @@@ int btrfs_relocate_chunk(struct btrfs_f
  
        /* step one, relocate all the extents inside this chunk */
        btrfs_scrub_pause(fs_info);
-       ret = btrfs_relocate_block_group(fs_info, chunk_offset, true);
+       ret = btrfs_relocate_block_group(fs_info, chunk_offset, verbose);
        btrfs_scrub_continue(fs_info);
        if (ret) {
                /*
@@@ -4456,7 -4456,7 +4456,7 @@@ again
                if (chunk_type & BTRFS_BLOCK_GROUP_METADATA_REMAP) {
                        mutex_unlock(&fs_info->reclaim_bgs_lock);
  
 -                      rci = kmalloc(sizeof(struct remap_chunk_info), 
GFP_NOFS);
 +                      rci = kmalloc_obj(struct remap_chunk_info, GFP_NOFS);
                        if (!rci) {
                                ret = -ENOMEM;
                                goto error;
@@@ -5004,7 -5004,7 +5004,7 @@@ int btrfs_recover_balance(struct btrfs_
                return 0;
        }
  
 -      bctl = kzalloc(sizeof(*bctl), GFP_NOFS);
 +      bctl = kzalloc_obj(*bctl, GFP_NOFS);
        if (!bctl)
                return -ENOMEM;
  
@@@ -6338,7 -6338,7 +6338,7 @@@ struct btrfs_io_context *alloc_btrfs_io
  {
        struct btrfs_io_context *bioc;
  
 -      bioc = kzalloc(struct_size(bioc, stripes, total_stripes), GFP_NOFS);
 +      bioc = kzalloc_flex(*bioc, stripes, total_stripes, GFP_NOFS);
  
        if (!bioc)
                return NULL;
@@@ -6471,7 -6471,7 +6471,7 @@@ struct btrfs_discard_stripe *btrfs_map_
                stripe_nr /= map->num_stripes;
        }
  
 -      stripes = kcalloc(*num_stripes, sizeof(*stripes), GFP_NOFS);
 +      stripes = kzalloc_objs(*stripes, *num_stripes, GFP_NOFS);
        if (!stripes) {
                ret = -ENOMEM;
                goto out_free_map;
@@@ -7204,7 -7204,7 +7204,7 @@@ struct btrfs_device *btrfs_alloc_device
        if (WARN_ON(!devid && !fs_info))
                return ERR_PTR(-EINVAL);
  
 -      dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 +      dev = kzalloc_obj(*dev);
        if (!dev)
                return ERR_PTR(-ENOMEM);
  
diff --combined fs/btrfs/zoned.c
index 39930d99943c1,92b5ac8fac378..817ca4fb9efa9
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@@ -337,7 -337,10 +337,10 @@@ int btrfs_get_dev_zone_info_all_devices
        if (!btrfs_fs_incompat(fs_info, ZONED))
                return 0;
  
-       mutex_lock(&fs_devices->device_list_mutex);
+       /*
+        * No need to take the device_list mutex here, we're still in the mount
+        * path and devices cannot be added to or removed from the list yet.
+        */
        list_for_each_entry(device, &fs_devices->devices, dev_list) {
                /* We can skip reading of zone info for missing devices */
                if (!device->bdev)
@@@ -347,7 -350,6 +350,6 @@@
                if (ret)
                        break;
        }
-       mutex_unlock(&fs_devices->device_list_mutex);
  
        return ret;
  }
@@@ -377,7 -379,7 +379,7 @@@ int btrfs_get_dev_zone_info(struct btrf
        if (device->zone_info)
                return 0;
  
 -      zone_info = kzalloc(sizeof(*zone_info), GFP_KERNEL);
 +      zone_info = kzalloc_obj(*zone_info);
        if (!zone_info)
                return -ENOMEM;
  
@@@ -454,7 -456,7 +456,7 @@@
                goto out;
        }
  
 -      zones = kvcalloc(BTRFS_REPORT_NR_ZONES, sizeof(struct blk_zone), 
GFP_KERNEL);
 +      zones = kvzalloc_objs(struct blk_zone, BTRFS_REPORT_NR_ZONES);
        if (!zones) {
                ret = -ENOMEM;
                goto out;

-- 
LinuxNextTracking

Reply via email to