On 8.11.18 г. 10:33 ч., Anand Jain wrote:
> 
> 
> On 11/07/2018 08:19 PM, Nikolay Borisov wrote:
>>
>>
>> On 7.11.18 г. 13:43 ч., Anand Jain wrote:
>>> +        /* scrub for replace must not be running in suspended state */
>>> +        if (btrfs_scrub_cancel(fs_info) != -ENOTCONN)
>>> +            ASSERT(0);
>>
>> ASSERT(btrfs_scrub_cancel(fs_info) == -ENOTCONN)
>>
> 
> There will be substantial difference in code when compiled with and
> without CONFIG_BTRFS_ASSERT [1]. That is, btrfs_scrub_cancel(fs_info)
> won't be run at all,  I would like to keep it as it is.

Fair point, in that case do:

ret = btrfs_scrub_cancel(fs_info);
ASSERT(ret != -ENOTCONN);

result


> 
> [1]
> ------
> ./fs/btrfs/ctree.h
> #ifdef CONFIG_BTRFS_ASSERT
> 
> __cold
> static inline void assfail(const char *expr, const char *file, int line)
> {
>         pr_err("assertion failed: %s, file: %s, line: %d\n",
>                expr, file, line);
>         BUG();
> }
> 
> #define ASSERT(expr)    \
>         (likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
> #else
> #define ASSERT(expr)    ((void)0)
> #endif
> -------
> 
> Thanks, Anand
> 
> 

Reply via email to