On Thu, Oct 23, 2014 at 02:30:08PM +0800, Anand Jain wrote: > introduce a global variable scan_done, which is set when scan is > done succssfully per thread. So that following calls to this function > will just return success. The rest is good, I'm a bit concerned about the global variable. It sholud be at least declared static and not visible outside of utils.c. The function btrfs_scan_lblkid is called indirectly from various callchains. For a moment I was thinking about declaring a variable to hold the scanning status, but btrfs_scan_lblkid is not always called from a scope of one cmd_something function. Eg. from btrfs_scan_fs_devices that in turn is called from several other functions. As we're not concerned about multi-threading, we can use the global variable. > Further if any function needs to force scan after scan_done is set, > then it can be done when there is such a requirement, but as of now there > isn't any such requirement. Right, then we could introduce something like btrfs_scan_reset_status and then btrfs_scan_lblkid would work as usual. > --- a/utils.c > +++ b/utils.c > @@ -52,6 +52,8 @@ > #define BLKDISCARD _IO(0x12,119) > #endif > > +int scan_done = 0; I'll change it to the following and add to integration. int btrfs_scan_done = 0; -- 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
