Message ID | 8201f6ae724c5dbc7c82f2ed294d457db208b2fa.1733695544.git.beckerlee3@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | btrfs: edit prelim_ref_insert() to use rb helpers | expand |
Hi Roger, kernel test robot noticed the following build errors: [auto build test ERROR on kdave/for-next] [also build test ERROR on linus/master v6.13-rc2 next-20241206] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Roger-L-Beckermeyer-III/btrfs-edit-prelim_ref_insert-to-use-rb-helpers/20241209-064043 base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next patch link: https://lore.kernel.org/r/8201f6ae724c5dbc7c82f2ed294d457db208b2fa.1733695544.git.beckerlee3%40gmail.com patch subject: [PATCH] btrfs: edit prelim_ref_insert() to use rb helpers config: arc-randconfig-002-20241209 (https://download.01.org/0day-ci/archive/20241209/202412090922.Cg7LuOhS-lkp@intel.com/config) compiler: arc-elf-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241209/202412090922.Cg7LuOhS-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/202412090922.Cg7LuOhS-lkp@intel.com/ All error/warnings (new ones prefixed by >>): fs/btrfs/backref.c: In function 'prelim_ref_insert': >> fs/btrfs/backref.c:302:17: error: implicit declaration of function 'rb_find_add_cached'; did you mean 'rb_find_add_rcu'? [-Werror=implicit-function-declaration] 302 | exist = rb_find_add_cached(&newref->rbnode, root, prelim_ref_cmp); | ^~~~~~~~~~~~~~~~~~ | rb_find_add_rcu >> fs/btrfs/backref.c:302:15: warning: assignment to 'struct rb_node *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 302 | exist = rb_find_add_cached(&newref->rbnode, root, prelim_ref_cmp); | ^ cc1: some warnings being treated as errors vim +302 fs/btrfs/backref.c 280 281 /* 282 * Add @newref to the @root rbtree, merging identical refs. 283 * 284 * Callers should assume that newref has been freed after calling. 285 */ 286 static void prelim_ref_insert(const struct btrfs_fs_info *fs_info, 287 struct preftree *preftree, 288 struct prelim_ref *newref, 289 struct share_check *sc) 290 { 291 struct rb_root_cached *root; 292 struct rb_node **p; 293 struct rb_node *parent = NULL; 294 struct prelim_ref *ref; 295 struct rb_node *exist; 296 297 root = &preftree->root; 298 p = &root->rb_root.rb_node; 299 parent = *p; 300 ref = rb_entry(parent, struct prelim_ref, rbnode); 301 > 302 exist = rb_find_add_cached(&newref->rbnode, root, prelim_ref_cmp); 303 if (exist != NULL) { 304 /* Identical refs, merge them and free @newref */ 305 struct extent_inode_elem *eie = ref->inode_list; 306 307 while (eie && eie->next) 308 eie = eie->next; 309 310 if (!eie) 311 ref->inode_list = newref->inode_list; 312 else 313 eie->next = newref->inode_list; 314 trace_btrfs_prelim_ref_merge(fs_info, ref, newref, 315 preftree->count); 316 /* 317 * A delayed ref can have newref->count < 0. 318 * The ref->count is updated to follow any 319 * BTRFS_[ADD|DROP]_DELAYED_REF actions. 320 */ 321 update_share_count(sc, ref->count, 322 ref->count + newref->count, newref); 323 ref->count += newref->count; 324 free_pref(newref); 325 return; 326 } 327 328 update_share_count(sc, 0, newref->count, newref); 329 preftree->count++; 330 trace_btrfs_prelim_ref_insert(fs_info, newref, NULL, preftree->count); 331 } 332
Hi Roger, kernel test robot noticed the following build errors: [auto build test ERROR on kdave/for-next] [also build test ERROR on linus/master v6.13-rc2 next-20241206] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Roger-L-Beckermeyer-III/btrfs-edit-prelim_ref_insert-to-use-rb-helpers/20241209-064043 base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next patch link: https://lore.kernel.org/r/8201f6ae724c5dbc7c82f2ed294d457db208b2fa.1733695544.git.beckerlee3%40gmail.com patch subject: [PATCH] btrfs: edit prelim_ref_insert() to use rb helpers config: arm-randconfig-001-20241209 (https://download.01.org/0day-ci/archive/20241209/202412090958.CtUdYRwP-lkp@intel.com/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241209/202412090958.CtUdYRwP-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/202412090958.CtUdYRwP-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from fs/btrfs/backref.c:6: In file included from include/linux/mm.h:2223: include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ >> fs/btrfs/backref.c:302:10: error: call to undeclared function 'rb_find_add_cached'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 302 | exist = rb_find_add_cached(&newref->rbnode, root, prelim_ref_cmp); | ^ >> fs/btrfs/backref.c:302:8: error: incompatible integer to pointer conversion assigning to 'struct rb_node *' from 'int' [-Wint-conversion] 302 | exist = rb_find_add_cached(&newref->rbnode, root, prelim_ref_cmp); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning and 2 errors generated. vim +/rb_find_add_cached +302 fs/btrfs/backref.c 280 281 /* 282 * Add @newref to the @root rbtree, merging identical refs. 283 * 284 * Callers should assume that newref has been freed after calling. 285 */ 286 static void prelim_ref_insert(const struct btrfs_fs_info *fs_info, 287 struct preftree *preftree, 288 struct prelim_ref *newref, 289 struct share_check *sc) 290 { 291 struct rb_root_cached *root; 292 struct rb_node **p; 293 struct rb_node *parent = NULL; 294 struct prelim_ref *ref; 295 struct rb_node *exist; 296 297 root = &preftree->root; 298 p = &root->rb_root.rb_node; 299 parent = *p; 300 ref = rb_entry(parent, struct prelim_ref, rbnode); 301 > 302 exist = rb_find_add_cached(&newref->rbnode, root, prelim_ref_cmp); 303 if (exist != NULL) { 304 /* Identical refs, merge them and free @newref */ 305 struct extent_inode_elem *eie = ref->inode_list; 306 307 while (eie && eie->next) 308 eie = eie->next; 309 310 if (!eie) 311 ref->inode_list = newref->inode_list; 312 else 313 eie->next = newref->inode_list; 314 trace_btrfs_prelim_ref_merge(fs_info, ref, newref, 315 preftree->count); 316 /* 317 * A delayed ref can have newref->count < 0. 318 * The ref->count is updated to follow any 319 * BTRFS_[ADD|DROP]_DELAYED_REF actions. 320 */ 321 update_share_count(sc, ref->count, 322 ref->count + newref->count, newref); 323 ref->count += newref->count; 324 free_pref(newref); 325 return; 326 } 327 328 update_share_count(sc, 0, newref->count, newref); 329 preftree->count++; 330 trace_btrfs_prelim_ref_insert(fs_info, newref, NULL, preftree->count); 331 } 332
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 6d9f39c1d89c..fcbcfce0f93a 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -250,6 +250,17 @@ static int prelim_ref_compare(const struct prelim_ref *ref1, return 0; } +static int prelim_ref_cmp(struct rb_node *node, const struct rb_node *exist) +{ + int result; + struct prelim_ref *ref1 = rb_entry(node, struct prelim_ref, rbnode); + struct prelim_ref *ref2 = rb_entry(exist, struct prelim_ref, rbnode); + + result = prelim_ref_compare(ref1, ref2); + + return result; +} + static void update_share_count(struct share_check *sc, int oldcount, int newcount, const struct prelim_ref *newref) { @@ -281,52 +292,42 @@ static void prelim_ref_insert(const struct btrfs_fs_info *fs_info, struct rb_node **p; struct rb_node *parent = NULL; struct prelim_ref *ref; - int result; - bool leftmost = true; + struct rb_node *exist; root = &preftree->root; p = &root->rb_root.rb_node; + parent = *p; + ref = rb_entry(parent, struct prelim_ref, rbnode); - while (*p) { - parent = *p; - ref = rb_entry(parent, struct prelim_ref, rbnode); - result = prelim_ref_compare(ref, newref); - if (result < 0) { - p = &(*p)->rb_left; - } else if (result > 0) { - p = &(*p)->rb_right; - leftmost = false; - } else { - /* Identical refs, merge them and free @newref */ - struct extent_inode_elem *eie = ref->inode_list; + exist = rb_find_add_cached(&newref->rbnode, root, prelim_ref_cmp); + if (exist != NULL) { + /* Identical refs, merge them and free @newref */ + struct extent_inode_elem *eie = ref->inode_list; - while (eie && eie->next) - eie = eie->next; + while (eie && eie->next) + eie = eie->next; - if (!eie) - ref->inode_list = newref->inode_list; - else - eie->next = newref->inode_list; - trace_btrfs_prelim_ref_merge(fs_info, ref, newref, - preftree->count); - /* - * A delayed ref can have newref->count < 0. - * The ref->count is updated to follow any - * BTRFS_[ADD|DROP]_DELAYED_REF actions. - */ - update_share_count(sc, ref->count, - ref->count + newref->count, newref); - ref->count += newref->count; - free_pref(newref); - return; - } + if (!eie) + ref->inode_list = newref->inode_list; + else + eie->next = newref->inode_list; + trace_btrfs_prelim_ref_merge(fs_info, ref, newref, + preftree->count); + /* + * A delayed ref can have newref->count < 0. + * The ref->count is updated to follow any + * BTRFS_[ADD|DROP]_DELAYED_REF actions. + */ + update_share_count(sc, ref->count, + ref->count + newref->count, newref); + ref->count += newref->count; + free_pref(newref); + return; } update_share_count(sc, 0, newref->count, newref); preftree->count++; trace_btrfs_prelim_ref_insert(fs_info, newref, NULL, preftree->count); - rb_link_node(&newref->rbnode, parent, p); - rb_insert_color_cached(&newref->rbnode, root, leftmost); } /*