* fs/ocfs2/aops.c:2872:22: warning: variable 'max_blocks' set but not used
@ 2026-08-14 13:38 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-08-14 13:38 UTC (permalink / raw)
To: Heming Zhao; +Cc: oe-kbuild-all, 0day robot, Joseph Qi
tree: https://github.com/intel-lab-lkp/linux/commits/Heming-Zhao/ocfs2-Add-new-ocfs2_map_blocks-to-introduce-iomap-feature/20260811-043801
head: 4d6a46254590fa90285d4856f4ad8301cef54200
commit: a79c0c3913814518686f2e87426267431ecfbaa0 ocfs2: switch dio write path from buffer_head to iomap
date: 4 days ago
config: x86_64-rhel-9.4-ltp (https://download.01.org/0day-ci/archive/20260814/202608141535.kOQ9g2e6-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/20260814/202608141535.kOQ9g2e6-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/202608141535.kOQ9g2e6-lkp@intel.com/
All warnings (new ones prefixed by >>):
fs/ocfs2/aops.c: In function 'ocfs2_iomap_dio_end_io_write':
>> fs/ocfs2/aops.c:2872:22: warning: variable 'max_blocks' set but not used [-Wunused-but-set-variable]
2872 | unsigned int max_blocks;
| ^~~~~~~~~~
vim +/max_blocks +2872 fs/ocfs2/aops.c
2853
2854 /* copy from ocfs2_dio_end_io_write */
2855 static int ocfs2_iomap_dio_end_io_write(struct inode *inode,
2856 loff_t offset,
2857 ssize_t bytes)
2858 {
2859 struct ocfs2_cached_dealloc_ctxt dealloc;
2860 struct ocfs2_extent_tree et;
2861 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
2862 struct ocfs2_inode_info *oi = OCFS2_I(inode);
2863 struct buffer_head *di_bh = NULL;
2864 struct ocfs2_dinode *di;
2865 struct ocfs2_alloc_context *data_ac = NULL;
2866 struct ocfs2_alloc_context *meta_ac = NULL;
2867 handle_t *handle = NULL;
2868 loff_t end = offset + bytes;
2869 int ret = 0, credits = 0;
2870 struct ocfs2_map_block map;
2871 unsigned int blkbits = inode->i_blkbits;
> 2872 unsigned int max_blocks;
2873 unsigned int ue_cpos = 0, ue_phys = 0, ue_len = 0;
2874 unsigned int curr_lblk, end_lblk;
2875
2876 map.lblk = offset >> blkbits;
2877 max_blocks = (bytes + offset) >> osb->s_clustersize_bits;
2878
2879 ocfs2_init_dealloc_ctxt(&dealloc);
2880
2881 ret = ocfs2_inode_lock(inode, &di_bh, 1);
2882 if (ret < 0) {
2883 mlog_errno(ret);
2884 goto out;
2885 }
2886
2887 down_write(&oi->ip_alloc_sem);
2888
2889 di = (struct ocfs2_dinode *)di_bh->b_data;
2890
2891 ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh);
2892
2893 /* Attach dealloc with extent tree in case that we may reuse extents
2894 * which are already unlinked from current extent tree due to extent
2895 * rotation and merging.
2896 */
2897 et.et_dealloc = &dealloc;
2898
2899 ret = ocfs2_lock_allocators(inode, &et, 0, (bytes >> osb->s_clustersize_bits)*2,
2900 &data_ac, &meta_ac);
2901 if (ret) {
2902 mlog_errno(ret);
2903 goto unlock;
2904 }
2905
2906 credits = ocfs2_calc_extend_credits(inode->i_sb, &di->id2.i_list);
2907
2908 handle = ocfs2_start_trans(osb, credits);
2909 if (IS_ERR(handle)) {
2910 ret = PTR_ERR(handle);
2911 mlog_errno(ret);
2912 goto unlock;
2913 }
2914 ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
2915 OCFS2_JOURNAL_ACCESS_WRITE);
2916 if (ret) {
2917 mlog_errno(ret);
2918 goto commit;
2919 }
2920
2921 curr_lblk = offset >> blkbits;
2922 /*
2923 * Round the end up so the final partial block (sub-block direct I/O)
2924 * is included; otherwise the last, partially-written cluster is left
2925 * unwritten and reads back as zero.
2926 */
2927 end_lblk = (offset + bytes + (1 << blkbits) - 1) >> blkbits;
2928 while (ret >= 0 && curr_lblk < end_lblk) {
2929 memset(&map, 0, sizeof(map));
2930 map.lblk += curr_lblk;
2931 map.len = end_lblk - curr_lblk;
2932
2933 ret = ocfs2_assure_trans_credits(handle, credits);
2934 if (ret < 0) {
2935 mlog_errno(ret);
2936 break;
2937 }
2938
2939 ret = ocfs2_map_blocks(inode, &map, 0);
2940 if (ret < 0) {
2941 mlog_errno(ret);
2942 break;
2943 }
2944 if (ret == 0)
2945 break;
2946
2947 if (map.flags & OCFS2_MAP_UNWRITTEN) {
2948 ue_cpos = ocfs2_blocks_to_clusters(inode->i_sb, map.lblk);
2949 ue_phys = ocfs2_blocks_to_clusters(inode->i_sb, map.pblk);
2950 ue_len = ocfs2_clusters_for_blocks(inode->i_sb,
2951 map.lblk + map.len) - ue_cpos;
2952
2953 ret = ocfs2_mark_extent_written(inode, &et, handle,
2954 ue_cpos, ue_len,
2955 ue_phys,
2956 meta_ac, &dealloc);
2957 if (ret < 0) {
2958 mlog_errno(ret);
2959 break;
2960 }
2961 }
2962 curr_lblk += map.len;
2963 }
2964
2965 if (end > i_size_read(inode)) {
2966 ret = ocfs2_set_inode_size(handle, inode, di_bh, end);
2967 if (ret < 0)
2968 mlog_errno(ret);
2969 }
2970
2971 commit:
2972 ocfs2_commit_trans(osb, handle);
2973
2974 unlock:
2975 up_write(&oi->ip_alloc_sem);
2976
2977 if (data_ac)
2978 ocfs2_free_alloc_context(data_ac);
2979 if (meta_ac)
2980 ocfs2_free_alloc_context(meta_ac);
2981
2982 down_write(&oi->ip_alloc_sem);
2983 if (!ret && (di->i_flags & cpu_to_le32(OCFS2_DIO_ORPHANED_FL))) {
2984 ret = ocfs2_del_inode_from_orphan(osb, inode, di_bh, 0, 0);
2985 if (ret < 0)
2986 mlog_errno(ret);
2987 }
2988 up_write(&oi->ip_alloc_sem);
2989 ocfs2_inode_unlock(inode, 1);
2990 brelse(di_bh);
2991
2992 out:
2993 ocfs2_run_deallocs(osb, &dealloc);
2994 return ret;
2995 }
2996
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-14 13:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 13:38 fs/ocfs2/aops.c:2872:22: warning: variable 'max_blocks' set but not used kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.