Message ID | 20170607005844.2078-8-nefelim4ag@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Timofey, [auto build test WARNING on next-20170605] [also build test WARNING on v4.12-rc4] [cannot apply to btrfs/next v4.9-rc8 v4.9-rc7 v4.9-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Timofey-Titovets/Btrfs-if-else-cleanups/20170608-055223 config: x86_64-randconfig-x016-201723 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): fs//btrfs/disk-io.c: In function 'end_workqueue_bio': >> fs//btrfs/disk-io.c:843:2: warning: 'func' may be used uninitialized in this function [-Wmaybe-uninitialized] btrfs_init_work(&end_io_wq->work, func, end_workqueue_fn, NULL, NULL); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> fs//btrfs/disk-io.c:844:2: warning: 'wq' may be used uninitialized in this function [-Wmaybe-uninitialized] btrfs_queue_work(wq, &end_io_wq->work); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +/func +843 fs//btrfs/disk-io.c 9e0af237 Liu Bo 2014-08-15 837 } else { 9e0af237 Liu Bo 2014-08-15 838 wq = fs_info->endio_workers; 9e0af237 Liu Bo 2014-08-15 839 func = btrfs_endio_helper; d20f7043 Chris Mason 2008-12-08 840 } ce9adaa5 Chris Mason 2008-04-09 841 } ce9adaa5 Chris Mason 2008-04-09 842 9e0af237 Liu Bo 2014-08-15 @843 btrfs_init_work(&end_io_wq->work, func, end_workqueue_fn, NULL, NULL); 9e0af237 Liu Bo 2014-08-15 @844 btrfs_queue_work(wq, &end_io_wq->work); ce9adaa5 Chris Mason 2008-04-09 845 } ce9adaa5 Chris Mason 2008-04-09 846 22c59948 Chris Mason 2008-04-09 847 int btrfs_bio_wq_end_io(struct btrfs_fs_info *info, struct bio *bio, :::::: The code at line 843 was first introduced by commit :::::: 9e0af23764344f7f1b68e4eefbe7dc865018b63d Btrfs: fix task hang under heavy compressed write :::::: TO: Liu Bo <bo.li.liu@oracle.com> :::::: CC: Chris Mason <clm@fb.com> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8685d6718..72208826d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -802,18 +802,27 @@ static void end_workqueue_bio(struct bio *bio) end_io_wq->error = bio->bi_error; if (bio_op(bio) == REQ_OP_WRITE) { - if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) { + switch (end_io_wq->metadata) { + case BTRFS_WQ_ENDIO_DATA: + wq = fs_info->endio_write_workers; + func = btrfs_endio_write_helper; + break; + case BTRFS_WQ_ENDIO_METADATA: wq = fs_info->endio_meta_write_workers; func = btrfs_endio_meta_write_helper; - } else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_FREE_SPACE) { + break; + case BTRFS_WQ_ENDIO_FREE_SPACE: wq = fs_info->endio_freespace_worker; func = btrfs_freespace_write_helper; - } else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) { + break; + case BTRFS_WQ_ENDIO_RAID56: wq = fs_info->endio_raid56_workers; func = btrfs_endio_raid56_helper; - } else { + break; + case BTRFS_WQ_ENDIO_DIO_REPAIR: wq = fs_info->endio_write_workers; func = btrfs_endio_write_helper; + break; } } else { if (unlikely(end_io_wq->metadata ==
If arg to "switch case" is determined and it's a consecutive numbers (This is enum btrfs_wq_endio_type) Compiler can create jump table to optimize logic Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com> --- fs/btrfs/disk-io.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) -- 2.13.0 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html