Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp494757lqb; Thu, 14 Mar 2024 18:46:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAddNvCTxMUyeuqsznpkDUxUMxmZ4ywb+nkOkX9Mg8jGB0AtgB88cdEM0/5tXqTkhnjzGptWa5XA36vkJaGvwQ2cdvhetgw0tJD574nw== X-Google-Smtp-Source: AGHT+IELwSoo1nk6BfxqW2wU7ficQUvXLYOTABCCsQLEhi/yBQmpU9YiIPduB04YQu3vx//QzpLL X-Received: by 2002:a2e:9bc2:0:b0:2d4:49d0:d210 with SMTP id w2-20020a2e9bc2000000b002d449d0d210mr2024751ljj.50.1710467217445; Thu, 14 Mar 2024 18:46:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710467217; cv=pass; d=google.com; s=arc-20160816; b=Qf1JWvqkI7jaoeIn8rMxGNRjzs+hXGFosGPYOroQks0d0a5QbpXlVlZ70T1NpuY006 vCTuxZvO1HnE1SAydxYrueuHB4A/c2NhhG1jvS2vgfhBAExr0NH/fUS3DHrtmCbpTTAC 5ThWTyPadr2gDF5X5h3mD22UG6BwYt9/V29Dho2pAeYRLJa5neLDQmSQV7p/zUjWtnP8 kmtefNt2/izEAFA54KpJibkIKRefzF2bMKL9SyvGxj2QhhVwWXhF9/6s1OrtZHnbD+WG 8vEZadiUfCS405sKFmBMKUT3JuDZIPXRuczjQDXb35mUxrpvnn/If/MTyxgddSZXXexh k0hw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=RK3WS8YU/TIO9C5L+2WMErB8Z6UUjxPHl/ZVfvjJt24=; fh=P/UJx2/FjEVFc2OPVxyAoo7N0f1Ss35XHnNQkrmcglI=; b=Bnuc3g+SHGsssg8aie88xPi/Y5YH/qGXpKJ0WK1zzUkDqZ15iKF4ABEwKOaWOopE9y OtoXazIFeolvQ4Auuh4LkM/OOt2MAJHn5a/7/FnSZ+3VOxi9xmIZ7T83y9dxgmqzywi5 W97BPYb8h8S3nWULwNorFsx7BPalZ83xRsvWzsxh/nZUp9PQBnpVoUgslwQaQUqIqr/o iQH6EJQjA0/vTu2bEoaJAnd1AmibH7n/c1xBNuKg3m3B8kY6r/jRHcs8eSQuEsuXIBCM 1F4CQIfelwRj1/Lzxj9OunEi4M3Cr0cGkqWnKiSQoJgM8SnU+hiur8o3cGSCeVKzGBSk 8rUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iaswfEPZ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-103972-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103972-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bf20-20020a0564021a5400b0056802618891si1217877edb.369.2024.03.14.18.46.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 18:46:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103972-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iaswfEPZ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-103972-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103972-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 647D91F2135E for ; Fri, 15 Mar 2024 01:46:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3205A6127; Fri, 15 Mar 2024 01:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iaswfEPZ" Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6450933CA for ; Fri, 15 Mar 2024 01:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710467204; cv=none; b=HPyCN+ovZ89UqLptEB8jrYD9iqd7dDwp/OGgYsEKXrBKTuJ9ekNPdIQGVkNQNFPvRWQsJ30d+kUxa3uqlgkEwGqACkM5pn7GFazGKUmDh5IGTzJdLRKpZ1Ay5kbr85HClUHzyqk4edsx/DQLOg6RPnnUHrZROTNxFxbRHN/mDgU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710467204; c=relaxed/simple; bh=q8iNWbjGQ+D2fJoo5tG/XMd3JR2XkDgUd51iBpSBcvs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=nR+F9vxm6apYb3ORmo4RxP/6wlJGC8V84cXEMBDelAcJnbCutzLJTSMdrNeGhj83Ga0/tWtLybGBuShhfwDP12Db3GMMIAfDPvRMfU7olWSNwLtU1zZ6krVohztAqhKTC2U2OnvPHIKuQBgr4ctiIG7XchU0HC/u+UnPWIaGnas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iaswfEPZ; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2d204e102a9so19527601fa.0 for ; Thu, 14 Mar 2024 18:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710467200; x=1711072000; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RK3WS8YU/TIO9C5L+2WMErB8Z6UUjxPHl/ZVfvjJt24=; b=iaswfEPZT5rbY3cOYprl4IwFdQ0jFzaompVy30DWJtfA7jtjYHtyLot3Xu39EdnRzA vctpSOwaQMYXTYH6goHGiEj7t1Lo6HAZWHdarau8M1JSsjf1ZYAcaZyg2DFWal32ylMS +uRLWMV4QuvHhbUuu0xS8FFq7DBR5KaIc/PrHylcAnylc/SPbXd55UH8Yaxe55X18ykz u2EQUe8eygBeEudVMpAcB9dx1ipmJKBwpHAWAXQez9cWaYuB/b+PgIUSqI2oXG9btuQ7 qpaTI5riUAQUqPHDJYISLvfQMiXp5zZkVlkSu48gSTChAM2kr/hiu3wnYZfvjV5GE29w tm+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710467200; x=1711072000; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RK3WS8YU/TIO9C5L+2WMErB8Z6UUjxPHl/ZVfvjJt24=; b=vX9eHYmNK+Tp4JDcHy97PES6LnHxcjMfvhvG4BUwm9o0vVCOJxTMLUpG/lyJvdRTAp 42qOuY7OZOfPnAIgsim6Vs/rYxHnzRybkarmeRN+YrkchSgEkWI4i1KOtEoj0mwhGF7N kchWlLBFqcelQ/Fz+hAPLSL6kHQOLTpfzlGGg8FlmW4RPLJ2WKYArp/bwisSU+PkuvRY 4o/AnCkZFAND1HHHGoUqi5oFfGo25PgAQjiaOvVFn7rvZDDzFJ59J6iZN+3ZNkB9I8qM RyfncIfMu7W/yCBzrGK5jRCQL2NJS3qCD+HpjFBtVUHHX/N6YBJFJl4ddXmaZXK/fkDc mxvw== X-Forwarded-Encrypted: i=1; AJvYcCUttaJXjiDTYJpqOOwdfWhOwp9CEN3qNp6NnAC79lzNTyb2YTXE3wfnRRDgDBtG+UQ3ThSH8pWCgs6M4P0QTD3T7tdGaGHbKcrZDyf2 X-Gm-Message-State: AOJu0YyJhgLjrKpng5+EFIUewbHNoCmIEns7cQauPllrGfOwf6qJfqC3 w3VNRPt8csVt+AopwtbmO9wCvjZOGNqp77+PseA/nMbnq+71Q5kb3NE41UEBS9ifqHaQwQXZein Rw/gKzWT1NNrjU2QHO20Gkjvuf5w= X-Received: by 2002:a05:651c:32a:b0:2d4:3c64:53f5 with SMTP id b10-20020a05651c032a00b002d43c6453f5mr1972795ljp.19.1710467200055; Thu, 14 Mar 2024 18:46:40 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1710303061-16822-1-git-send-email-zhiguo.niu@unisoc.com> In-Reply-To: From: Zhiguo Niu Date: Fri, 15 Mar 2024 09:46:28 +0800 Message-ID: Subject: Re: [PATCH] f2fs: add REQ_TIME time update for some user behaviors To: Chao Yu Cc: Zhiguo Niu , jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, ke.wang@unisoc.com, hongyu.jin@unisoc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Mar 14, 2024 at 9:06=E2=80=AFPM Chao Yu wrote: > > On 2024/3/13 12:11, Zhiguo Niu wrote: > > some user behaviors requested filesystem operations, which > > will cause filesystem not idle. > > Meanwhile adjust f2fs_update_time(REQ_TIME) of > > f2fs_ioc_defragment to successful case. > > > > Signed-off-by: Zhiguo Niu > > --- > > fs/f2fs/file.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > index 4dfe38e..dac3836 100644 > > --- a/fs/f2fs/file.c > > +++ b/fs/f2fs/file.c > > @@ -2784,7 +2784,6 @@ static int f2fs_ioc_defragment(struct file *filp,= unsigned long arg) > > err =3D f2fs_defragment_range(sbi, filp, &range); > > mnt_drop_write_file(filp); > > > > - f2fs_update_time(sbi, REQ_TIME); > > I guess we need to call f2fs_update_time() here if any data was > migrated. OK! > > if (range->len) > f2fs_update_time(sbi, REQ_TIME); > > > if (err < 0) > > return err; > > > > @@ -2792,6 +2791,7 @@ static int f2fs_ioc_defragment(struct file *filp,= unsigned long arg) > > sizeof(range))) > > return -EFAULT; > > > > + f2fs_update_time(sbi, REQ_TIME); > > return 0; > > } > > > > @@ -3331,6 +3331,7 @@ static int f2fs_ioc_resize_fs(struct file *filp, = unsigned long arg) > > if (copy_from_user(&block_count, (void __user *)arg, > > sizeof(block_count))) > > return -EFAULT; > > + f2fs_update_time(sbi, REQ_TIME); > > There will be no further IO in the end of f2fs_ioc_resize_fs(), so we don= 't > need to update time to delay gc/discard thread? > > > > > return f2fs_resize_fs(filp, block_count); > > } > > @@ -3424,6 +3425,7 @@ static int f2fs_ioc_setfslabel(struct file *filp,= unsigned long arg) > > f2fs_up_write(&sbi->sb_lock); > > > > mnt_drop_write_file(filp); > > + f2fs_update_time(sbi, REQ_TIME); > > Ditto, Dear Chao, The two parts you proposed should be similar to the below scenario? --------------------------------------------------------- static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long = arg) { struct inode *inode =3D file_inode(filp); if (!f2fs_sb_has_encrypt(F2FS_I_SB(inode))) return -EOPNOTSUPP; f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); return fscrypt_ioctl_set_policy(filp, (const void __user *)arg); } ----------------------------------------------------------- thanks! > > Thanks, > > > out: > > kfree(vbuf); > > return err; > > @@ -3597,6 +3599,7 @@ static int f2fs_release_compress_blocks(struct fi= le *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: > > inode_unlock(inode); > > > > @@ -3766,6 +3769,7 @@ static int f2fs_reserve_compress_blocks(struct fi= le *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: > > inode_unlock(inode); > > @@ -3964,6 +3968,7 @@ static int f2fs_sec_trim_file(struct file *filp, = unsigned long arg) > > if (len) > > ret =3D 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]); > > @@ -4173,6 +4178,7 @@ static int f2fs_ioc_decompress_file(struct file *= filp) > > if (ret) > > f2fs_warn(sbi, "%s: The file might be partially decompres= sed (errno=3D%d). Please delete the file.", > > __func__, ret); > > + f2fs_update_time(sbi, REQ_TIME); > > out: > > inode_unlock(inode); > > file_end_write(filp); > > @@ -4252,6 +4258,7 @@ static int f2fs_ioc_compress_file(struct file *fi= lp) > > if (ret) > > f2fs_warn(sbi, "%s: The file might be partially compresse= d (errno=3D%d). Please delete the file.", > > __func__, ret); > > + f2fs_update_time(sbi, REQ_TIME); > > out: > > inode_unlock(inode); > > file_end_write(filp);