Messages in this thread | | | Date | Sun, 21 Nov 2021 05:03:28 +0800 | From | kernel test robot <> | Subject | fs/ext4/orphan.c:78:18: sparse: sparse: cast from restricted __le32 |
| |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: a90af8f15bdc9449ee2d24e1d73fa3f7e8633f81 commit: 4a79a98c7b19dd3d4cfe9200fbc384ba9119e039 ext4: Improve scalability of ext4 orphan file handling date: 3 months ago config: sparc64-randconfig-s031-20211116 (attached as .config) compiler: sparc64-linux-gcc (GCC) 11.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4a79a98c7b19dd3d4cfe9200fbc384ba9119e039 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 4a79a98c7b19dd3d4cfe9200fbc384ba9119e039 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc64 SHELL=/bin/bash drivers/usb/host/ fs/ext4/ lib/
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>) >> fs/ext4/orphan.c:78:18: sparse: sparse: cast from restricted __le32 >> fs/ext4/orphan.c:78:18: sparse: sparse: cast from restricted __le32 >> fs/ext4/orphan.c:78:18: sparse: sparse: cast to restricted __le32
vim +78 fs/ext4/orphan.c
10 11 static int ext4_orphan_file_add(handle_t *handle, struct inode *inode) 12 { 13 int i, j, start; 14 struct ext4_orphan_info *oi = &EXT4_SB(inode->i_sb)->s_orphan_info; 15 int ret = 0; 16 bool found = false; 17 __le32 *bdata; 18 int inodes_per_ob = ext4_inodes_per_orphan_block(inode->i_sb); 19 int looped = 0; 20 21 /* 22 * Find block with free orphan entry. Use CPU number for a naive hash 23 * for a search start in the orphan file 24 */ 25 start = raw_smp_processor_id()*13 % oi->of_blocks; 26 i = start; 27 do { 28 if (atomic_dec_if_positive(&oi->of_binfo[i].ob_free_entries) 29 >= 0) { 30 found = true; 31 break; 32 } 33 if (++i >= oi->of_blocks) 34 i = 0; 35 } while (i != start); 36 37 if (!found) { 38 /* 39 * For now we don't grow or shrink orphan file. We just use 40 * whatever was allocated at mke2fs time. The additional 41 * credits we would have to reserve for each orphan inode 42 * operation just don't seem worth it. 43 */ 44 return -ENOSPC; 45 } 46 47 ret = ext4_journal_get_write_access(handle, inode->i_sb, 48 oi->of_binfo[i].ob_bh, EXT4_JTR_ORPHAN_FILE); 49 if (ret) { 50 atomic_inc(&oi->of_binfo[i].ob_free_entries); 51 return ret; 52 } 53 54 bdata = (__le32 *)(oi->of_binfo[i].ob_bh->b_data); 55 /* Find empty slot in a block */ 56 j = 0; 57 do { 58 if (looped) { 59 /* 60 * Did we walk through the block several times without 61 * finding free entry? It is theoretically possible 62 * if entries get constantly allocated and freed or 63 * if the block is corrupted. Avoid indefinite looping 64 * and bail. We'll use orphan list instead. 65 */ 66 if (looped > 3) { 67 atomic_inc(&oi->of_binfo[i].ob_free_entries); 68 return -ENOSPC; 69 } 70 cond_resched(); 71 } 72 while (bdata[j]) { 73 if (++j >= inodes_per_ob) { 74 j = 0; 75 looped++; 76 } 77 } > 78 } while (cmpxchg(&bdata[j], (__le32)0, cpu_to_le32(inode->i_ino)) != 79 (__le32)0); 80 81 EXT4_I(inode)->i_orphan_idx = i * inodes_per_ob + j; 82 ext4_set_inode_state(inode, EXT4_STATE_ORPHAN_FILE); 83 84 return ext4_handle_dirty_metadata(handle, NULL, oi->of_binfo[i].ob_bh); 85 } 86
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [unhandled content-type:application/gzip] | |