On 12/08/2017 07:08 PM, Dan Carpenter wrote:
Hello Anand Jain,
The patch 2dcfcdc43524: "btrfs: cleanup device states define
BTRFS_DEV_STATE_IN_FS_METADATA" from Dec 4, 2017, leads to the
following static checker warning:
fs/btrfs/super.c:2007 btrfs_calc_avail_data_space()
warn: test_bit() takes a bit number
fs/btrfs/super.c
2004
2005 rcu_read_lock();
2006 list_for_each_entry_rcu(device, &fs_devices->devices, dev_list) {
2007 if (!test_bit(BTRFS_DEV_STATE_IN_FS_METADATA,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This BTRFS_DEV_STATE_IN_FS_METADATA define is BIT(1) but for test_bit()
we should just take 1. In other words we are doing double BIT(BIT(1)).
2008 &device->dev_state) ||
2009 !device->bdev ||
2010 test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state))
2011 continue;
2012
2013 if (i >= nr_devices)
2014 break;
2015
Thanks Dan. I fixed all these in v3.
- Anand
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html