From: Greg KH <gregkh@linuxfoundation.org>
To: Daeho Jeong <daeho43@gmail.com>
Cc: linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com,
Daeho Jeong <daehojeong@google.com>
Subject: Re: [PATCH v4] f2fs: add sysfs nodes to get runtime compression stat
Date: Fri, 12 Mar 2021 15:04:02 +0100 [thread overview]
Message-ID: <YEt00vJ6oVfoRjSJ@kroah.com> (raw)
In-Reply-To: <CACOAw_zhZ0OgT-KCBmD_H6_U=CZCNY44D-ojH2AZah2cbAvdAQ@mail.gmail.com>
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
next prev parent reply other threads:[~2021-03-12 14:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 12:25 [PATCH v4] f2fs: add sysfs nodes to get runtime compression stat Daeho Jeong
2021-03-12 12:39 ` Greg KH
2021-03-12 13:56 ` Daeho Jeong
2021-03-12 14:04 ` Greg KH [this message]
2021-03-12 14:37 ` Daeho Jeong
2021-03-12 14:42 ` Daeho Jeong
2021-03-12 14:49 ` Greg KH
2021-03-12 14:45 ` Greg KH
2021-03-13 0:00 ` Daeho Jeong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YEt00vJ6oVfoRjSJ@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=daeho43@gmail.com \
--cc=daehojeong@google.com \
--cc=kernel-team@android.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox