Received: by 10.223.176.5 with SMTP id f5csp264994wra; Fri, 2 Feb 2018 22:26:37 -0800 (PST) X-Google-Smtp-Source: AH8x224Gin6N4E7gdyq+w/5IwLJhrHIYFr7/jkZk3pXL8at/AfV0CGH1F2UpopJlDTf/GKsE/V8m X-Received: by 10.167.131.10 with SMTP id t10mr4963988pfm.234.1517639197003; Fri, 02 Feb 2018 22:26:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517639196; cv=none; d=google.com; s=arc-20160816; b=l3kQu9i0oCN7Y+eVBSO4Zwcdf9CdUEdraN3rXXfPkKKDVGuijZ9dZs6jU9xXgiwyCa oYXdfWWt30wFfFa3b0IwJl1VwpTaMl9JCeEbB/jaiBj3hZWKqnYocncL8FzXj9vDKD7q GbWHO17suOPxA/cDbFm8wo14Y45DNJXTajqF2ckqwfkghMnNYvXHccPohEjCv+EJHnn8 pT6ff/U6u3l3cEDB7JtiNZC2tHvBcO+tR7uK7APhDjHy4l9xBeWTL6626RoqrsractAK R6GWuGWDtqrC8dtZLZ63UYrGfpF6v2gOBkFSgegWyv7StC6qC+2FoAApA0cj/F8PK0Fj McfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=ApeOmE0rpkfUntA7zTlgI0WzCwvXokY+zLhWr0TItF4=; b=eSLlqy/FiibEgX0jvri+Qa9Wmf0qiyPBxSkLe/STLZaVCP4T3w8Eh0fZY507LFaqAL ojhXAWySoTygsLuD8wVFePSHfuJ3nY7ZSc3215RWaHFpL7T6VZqzdnpalCSPHWH8ikZQ JtEBfFNyGJV/FO9py87A8IA6v57sxzV3bW0C04xtKi0Iq5NuO+QY97AUi0vzsWce9/uy adDGIjFZux8a1LU9JLSCakeXRhka2CRWMy1HZtYupovC6kua1dQl+wY+6foy/bRoB7Ge qQPz3us/KZVDosqOfZnTakbwu0qn3HN5ZXJq1/Y5IUugQXFCKHH56G+Xms4+1Da9Ag1z CKzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8-v6si3162571plr.97.2018.02.02.22.26.22; Fri, 02 Feb 2018 22:26:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752498AbeBCCsM (ORCPT + 99 others); Fri, 2 Feb 2018 21:48:12 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:46331 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751963AbeBCCsH (ORCPT ); Fri, 2 Feb 2018 21:48:07 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 8132A353289D6; Sat, 3 Feb 2018 10:48:04 +0800 (CST) Received: from huawei.com (10.107.193.250) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.361.1; Sat, 3 Feb 2018 10:47:58 +0800 From: Yunlong Song To: , , , , CC: , , , , , , Subject: [PATCH 1/2] f2fs: enable to gc page whose inode already atomic commit Date: Sat, 3 Feb 2018 10:47:47 +0800 Message-ID: <1517626068-49739-1-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.250] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If inode has already started to atomic commit, then set_page_dirty will not mix the gc pages with the inmem atomic pages, so the page can be gced safely. Signed-off-by: Yunlong Song --- fs/f2fs/data.c | 5 ++--- fs/f2fs/gc.c | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 7435830..edafcb6 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1580,14 +1580,13 @@ bool should_update_outplace(struct inode *inode, struct f2fs_io_info *fio) return true; if (S_ISDIR(inode->i_mode)) return true; - if (f2fs_is_atomic_file(inode)) - return true; if (fio) { if (is_cold_data(fio->page)) return true; if (IS_ATOMIC_WRITTEN_PAGE(fio->page)) return true; - } + } else if (f2fs_is_atomic_file(inode)) + return true; return false; } diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index b9d93fd..84ab3ff 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -622,7 +622,8 @@ static void move_data_block(struct inode *inode, block_t bidx, if (!check_valid_map(F2FS_I_SB(inode), segno, off)) goto out; - if (f2fs_is_atomic_file(inode)) + if (f2fs_is_atomic_file(inode) && + !f2fs_is_commit_atomic_write(inode)) goto out; if (f2fs_is_pinned_file(inode)) { @@ -729,7 +730,8 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type, if (!check_valid_map(F2FS_I_SB(inode), segno, off)) goto out; - if (f2fs_is_atomic_file(inode)) + if (f2fs_is_atomic_file(inode) && + !f2fs_is_commit_atomic_write(inode)) goto out; if (f2fs_is_pinned_file(inode)) { if (gc_type == FG_GC) -- 1.8.5.2