kbuild Development List
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [jlayton:btrfs-enomem 2/4] fs/btrfs/dir-item.c:108:12: error: static declaration of '__btrfs_insert_dir_item' follows non-static declaration
Date: Wed, 15 Jul 2026 05:20:03 +0200	[thread overview]
Message-ID: <202607150522.cdKYAZae-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git btrfs-enomem
head:   746fbc9ddb34e692540b3700e9c96edb73788460
commit: cc25c3e12a57d763b9d88429f09d28547d5eff68 [2/4] btrfs: pre-allocate delayed dir index before btree modification
config: x86_64-rhel-9.4-bpf (https://download.01.org/0day-ci/archive/20260715/202607150522.cdKYAZae-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260715/202607150522.cdKYAZae-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607150522.cdKYAZae-lkp@intel.com/

All errors (new ones prefixed by >>):

>> fs/btrfs/dir-item.c:108:12: error: static declaration of '__btrfs_insert_dir_item' follows non-static declaration
     108 | static int __btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
         |            ^~~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/btrfs/dir-item.c:11:
   fs/btrfs/dir-item.h:20:5: note: previous declaration of '__btrfs_insert_dir_item' with type 'int(struct btrfs_trans_handle *, const struct fscrypt_str *, struct btrfs_inode *, const struct btrfs_key *, u8,  u64,  struct btrfs_dir_index_prealloc *)' {aka 'int(struct btrfs_trans_handle *, const struct fscrypt_str *, struct btrfs_inode *, const struct btrfs_key *, unsigned char,  long long unsigned int,  struct btrfs_dir_index_prealloc *)'}
      20 | int __btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
         |     ^~~~~~~~~~~~~~~~~~~~~~~


vim +/__btrfs_insert_dir_item +108 fs/btrfs/dir-item.c

    99	
   100	/*
   101	 * insert a directory item in the tree, doing all the magic for
   102	 * both indexes. 'dir' indicates which objectid to insert it into,
   103	 * 'location' is the key to stuff into the directory item, 'type' is the
   104	 * type of the inode we're pointing to, and 'index' is the sequence number
   105	 * to use for the second index (if one is created).
   106	 * Will return 0 or -ENOMEM
   107	 */
 > 108	static int __btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
   109					   const struct fscrypt_str *name,
   110					   struct btrfs_inode *dir,
   111					   const struct btrfs_key *location, u8 type,
   112					   u64 index,
   113					   struct btrfs_dir_index_prealloc *prealloc)
   114	{
   115		int ret = 0;
   116		int ret2 = 0;
   117		struct btrfs_root *root = dir->root;
   118		BTRFS_PATH_AUTO_FREE(path);
   119		struct btrfs_dir_item *dir_item;
   120		struct extent_buffer *leaf;
   121		unsigned long name_ptr;
   122		struct btrfs_key key;
   123		struct btrfs_disk_key disk_key;
   124		u32 data_size;
   125		const bool need_delayed_index = (root != root->fs_info->tree_root);
   126		struct btrfs_dir_index_prealloc local_prealloc;
   127	
   128		key.objectid = btrfs_ino(dir);
   129		key.type = BTRFS_DIR_ITEM_KEY;
   130		key.offset = btrfs_name_hash(name->name, name->len);
   131	
   132		path = btrfs_alloc_path();
   133		if (!path)
   134			return -ENOMEM;
   135	
   136		btrfs_cpu_key_to_disk(&disk_key, location);
   137	
   138		/*
   139		 * Pre-allocate the delayed dir index before modifying the btree so
   140		 * that ENOMEM is returned before any on-disk state changes, allowing
   141		 * the caller to handle it gracefully instead of aborting.
   142		 */
   143		if (need_delayed_index && !prealloc) {
   144			ret = btrfs_prealloc_delayed_dir_index(dir, name->name,
   145							       name->len,
   146							       &local_prealloc);
   147			if (ret)
   148				return ret;
   149			memcpy(local_prealloc.item->data + sizeof(struct btrfs_dir_item),
   150			       name->name, name->len);
   151			prealloc = &local_prealloc;
   152		}
   153	
   154		data_size = sizeof(*dir_item) + name->len;
   155		dir_item = insert_with_overflow(trans, root, path, &key, data_size,
   156						name->name, name->len);
   157		if (IS_ERR(dir_item)) {
   158			ret = PTR_ERR(dir_item);
   159			if (ret == -EEXIST)
   160				goto second_insert;
   161			if (need_delayed_index)
   162				btrfs_free_delayed_dir_index_prealloc(trans, prealloc);
   163			goto out_free;
   164		}
   165	
   166		if (IS_ENCRYPTED(&dir->vfs_inode))
   167			type |= BTRFS_FT_ENCRYPTED;
   168	
   169		leaf = path->nodes[0];
   170		btrfs_set_dir_item_key(leaf, dir_item, &disk_key);
   171		btrfs_set_dir_flags(leaf, dir_item, type);
   172		btrfs_set_dir_data_len(leaf, dir_item, 0);
   173		btrfs_set_dir_name_len(leaf, dir_item, name->len);
   174		btrfs_set_dir_transid(leaf, dir_item, trans->transid);
   175		name_ptr = (unsigned long)(dir_item + 1);
   176	
   177		write_extent_buffer(leaf, name->name, name_ptr, name->len);
   178	
   179	second_insert:
   180		if (!need_delayed_index) {
   181			ret = 0;
   182			goto out_free;
   183		}
   184		btrfs_release_path(path);
   185	
   186		ret2 = btrfs_insert_delayed_dir_index_prealloc(trans, dir, prealloc,
   187							       &disk_key, type, index);
   188	out_free:
   189		if (ret)
   190			return ret;
   191		if (ret2)
   192			return ret2;
   193		return 0;
   194	}
   195	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2026-07-15  3:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  3:20 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-07-15  9:37 [jlayton:btrfs-enomem 2/4] fs/btrfs/dir-item.c:108:12: error: static declaration of '__btrfs_insert_dir_item' follows non-static declaration kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202607150522.cdKYAZae-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jlayton@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox