On Fri, Mar 12, 2021 at 10:56:13PM +0900, Daeho Jeong wrote:
> Thanks for suggesting me sysfs_emit().
> 
> For atomic values, actually, those are needed for writer part, not reader.
> 
> +#define add_compr_block_stat(inode, blocks)                            \
> +       do {                                                            \
> +               struct f2fs_sb_info *sbi = F2FS_I_SB(inode);            \
> +               int diff = F2FS_I(inode)->i_cluster_size - blocks;      \
> +               atomic64_add(blocks, &sbi->compr_written_block);        \
> +               atomic64_add(diff, &sbi->compr_saved_block);            \
> +       } while (0)
> 
> I needed a protection here, because they might be updated in the race 
> condition.

Why?  What are you trying to protect from "racing" here?

thanks,

greg k-h


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to