From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95FA3C433DB for ; Fri, 12 Mar 2021 14:04:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6636965011 for ; Fri, 12 Mar 2021 14:04:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231640AbhCLOEU (ORCPT ); Fri, 12 Mar 2021 09:04:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:55806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbhCLOEK (ORCPT ); Fri, 12 Mar 2021 09:04:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7BAD064FFB; Fri, 12 Mar 2021 14:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615557850; bh=Z08KZd6XrMC6qRWdyb9R0p3Owz2c8ouzIqWGshwdS5Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vJE8acp0N06zbLPyerx23BzjyRy1DimyrdB/y9XdHQ+nQR0Jh0dZHJVWPdqJtJR1V fs65+hQUbaUrfleJ/Srfak8oSBFLXeEQ88fm0CdvIET/cI9thvVbsnJbCS93LRoziH YtXwJnQrNVNf4NDU1/Q/CoW5mwovfuLw5apyfsdk= Date: Fri, 12 Mar 2021 15:04:02 +0100 From: Greg KH To: Daeho Jeong Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Subject: Re: [PATCH v4] f2fs: add sysfs nodes to get runtime compression stat Message-ID: References: <20210312122531.2717093-1-daeho43@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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