Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp110604lqt; Mon, 18 Mar 2024 03:02:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWWA4qTf341+JL1b/eRE7jQ2UOghN2QVs8jke5O2IdjdkKIwUqjvpS9zXofAi58ba+zBIHgPUeEoqo5mbBZjHXBIb6CSQy+qGz8hxALg== X-Google-Smtp-Source: AGHT+IGUyKaMZcTlMNfWvr2AJPD6Ed9MhMVYMvEgkcnU0m/uKoN5txbrajqXkOmlB5dE0VjDPkmt X-Received: by 2002:a05:622a:1445:b0:430:d8dc:f76 with SMTP id v5-20020a05622a144500b00430d8dc0f76mr984181qtx.21.1710756135510; Mon, 18 Mar 2024 03:02:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710756135; cv=pass; d=google.com; s=arc-20160816; b=mT81pYcxH2ZvMASo9mULKZaM8Vv3nDEM9kFzDl7gZM3XhvZI/sKB7v0J9eAR+Gqdgi RgWkhimVGSM3dfZFgm3AtgLvb1Z/glXOV+1wjWXtnmPjfELEOz99W+JvhXqj8/Lc+N9W 6FnqF1Sosk8c1ebZkJCt0CqWECnXNkWkJ+tAOWl7T1b0C812HikADyJ2ttlcXN7RPSp8 ef5JY+XhjVENNZ6Y2veRpt7+MkZFGX/B83jZktlaqD4tmVrRivBrE/Q3tRiT/cjWNwnQ uDUVtCQqRpqL0QGEcCH+IrC51KTIBr4QOZSE2MTJ3qUKUNknl8ZCLiJw0wBNGRU2TSPy E5Yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=WPq6WLYTqN7VnL7BPhqrLKgvIUbSGutyLY6c2cj74ls=; fh=W6COFBd4BX4Q4YpnsinfP4Lifuq45kIfChsHXFM1YEQ=; b=pqvuT0P9rWsUMXtQ0NSSCCQ5ED7qaSQL1yGdQfYI+zAElJzkFBBiVLAddzc5TbtEWA Avwdl9qCdESnn7OAukgm+E3Oh7ztAdt8ILHQygp7vEPOapCiPigmX1P9iyAUm5ggPh/B GZ6fRhcNuzKWkZcV9Vl8n/A8wQO3oVoZ+NTsO/hrZwnv5ooXulzj8uxiYrUOhellgGxh nUajgfz34YCyRDKyw4kHUqB7XUKQz1aAchnuOvostDY4Esvr3RyNlOspCWl2psN1EYN9 +sXOQQA7lztufD5uYrjxDH9N+C97geSwFHUIjz0SONfvosLpX3PNVs2mD+TY88SaG27m C43w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vRuIEI42; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-105933-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105933-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id n19-20020a05622a11d300b0042e5f6ad275si9378812qtk.183.2024.03.18.03.02.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 03:02:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-105933-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vRuIEI42; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-105933-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105933-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3DBF61C217EE for ; Mon, 18 Mar 2024 10:02:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B23832D047; Mon, 18 Mar 2024 10:02:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vRuIEI42" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCFB02CCB3 for ; Mon, 18 Mar 2024 10:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756128; cv=none; b=guxhbWM5Q8Z/nBsmesrI2rUQ/T+TJyUkJ+gvFIA7UCHFKANQrZZNFrRHlSYFObUM/QJuQHRKEFi/Bs9z9EweQw8iK2Pw6YTtmUiebmVV5eJMTJII0YBDmUxup/gmBaI9oTrHzvoYsuc/rsnn422mz+JBFCn/NisfrFWw9wxIoD8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710756128; c=relaxed/simple; bh=tda4FiMnApu30+uRV6hFBxyOyzn56uatU22g6W/0XNE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ebZOqURarvtnv5ahoUcwUJZVJDO1IngxawhTpu+ANvPPSmedu7ccnDOBiE7fcxDZa2FXAjTuZaSDACaGySVLRa8dF4WzTkl2webqKFXbo/f08ovwNdRcdsBrZOHgLx42dKh9KUnpjtG46afb6qL4iMNcQiKUQtjWATJZOBqUKCQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vRuIEI42; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81C3CC433C7; Mon, 18 Mar 2024 10:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710756128; bh=tda4FiMnApu30+uRV6hFBxyOyzn56uatU22g6W/0XNE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=vRuIEI42/m8mXeK6NKPHMDBhhvp0FuEujMLhLBq4QLB/RLzytZtRHLoONHaYdX5xm /EATDIF6JGteWt7sHr4TlYY+5lTgKc/c1z+uu+dMwHjvirUE+D+NVbzjuH8SVctD8j 9Hl7EvLlFUITixFAJerQsT8RNTvOznr+XyuOKGHc5/fEapHHKS+aVccmcyRHH5Togi PAZy2k/vyr/7WmxRRaRt6aiZdn6CXULpsjr3S0qYEYEryIUUkrsnhDdYDi5QGCt4m4 XlXrysdkRDGyP8cLWRrIr6wi9NBPrV1z1tEFcEfTCAskvC5LRkIN85xHGS8hlTj9R/ z0w+FiUb2FLFA== Message-ID: Date: Mon, 18 Mar 2024 18:02:03 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2] f2fs: add REQ_TIME time update for some user behaviors To: Zhiguo Niu , jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, niuzhiguo84@gmail.com, ke.wang@unisoc.com, hongyu.jin@unisoc.com References: <1710502356-11469-1-git-send-email-zhiguo.niu@unisoc.com> Content-Language: en-US From: Chao Yu In-Reply-To: <1710502356-11469-1-git-send-email-zhiguo.niu@unisoc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/3/15 19:32, Zhiguo Niu wrote: > some user behaviors requested filesystem operations, which > will cause filesystem not idle. > Meanwhile adjust some f2fs_update_time(REQ_TIME) positions. > > Signed-off-by: Zhiguo Niu > --- > v2: update patch according to Chao's suggestions > --- > --- > fs/f2fs/file.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 1761ad1..8c9d6ea 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -2354,13 +2354,14 @@ static bool uuid_is_nonzero(__u8 u[16]) > static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg) > { > struct inode *inode = file_inode(filp); > + int ret; > > if (!f2fs_sb_has_encrypt(F2FS_I_SB(inode))) > return -EOPNOTSUPP; > > + ret = fscrypt_ioctl_set_policy(filp, (const void __user *)arg); > f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); > - > - return fscrypt_ioctl_set_policy(filp, (const void __user *)arg); > + return ret; > } > > static int f2fs_ioc_get_encryption_policy(struct file *filp, unsigned long arg) > @@ -2786,7 +2787,8 @@ static int f2fs_ioc_defragment(struct file *filp, unsigned long arg) > err = f2fs_defragment_range(sbi, filp, &range); > mnt_drop_write_file(filp); > > - f2fs_update_time(sbi, REQ_TIME); > + if (range.len) > + f2fs_update_time(sbi, REQ_TIME); > if (err < 0) > return err; > > @@ -3599,6 +3601,7 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg) > > filemap_invalidate_unlock(inode->i_mapping); > f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); > + f2fs_update_time(sbi, REQ_TIME); > out: if (released_blocks) f2fs_update_time(); > inode_unlock(inode); > > @@ -3768,6 +3771,7 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg) > clear_inode_flag(inode, FI_COMPRESS_RELEASED); > inode_set_ctime_current(inode); > f2fs_mark_inode_dirty_sync(inode, true); > + f2fs_update_time(sbi, REQ_TIME); > } > unlock_inode: if (reserved_blocks) f2fs_update_time(); Thanks, > inode_unlock(inode); > @@ -3966,6 +3970,7 @@ static int f2fs_sec_trim_file(struct file *filp, unsigned long arg) > if (len) > ret = f2fs_secure_erase(prev_bdev, inode, prev_index, > prev_block, len, range.flags); > + f2fs_update_time(sbi, REQ_TIME); > out: > filemap_invalidate_unlock(mapping); > f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); > @@ -4175,6 +4180,7 @@ static int f2fs_ioc_decompress_file(struct file *filp) > if (ret) > f2fs_warn(sbi, "%s: The file might be partially decompressed (errno=%d). Please delete the file.", > __func__, ret); > + f2fs_update_time(sbi, REQ_TIME); > out: > inode_unlock(inode); > file_end_write(filp); > @@ -4254,6 +4260,7 @@ static int f2fs_ioc_compress_file(struct file *filp) > if (ret) > f2fs_warn(sbi, "%s: The file might be partially compressed (errno=%d). Please delete the file.", > __func__, ret); > + f2fs_update_time(sbi, REQ_TIME); > out: > inode_unlock(inode); > file_end_write(filp);