Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2259675ybz; Sun, 26 Apr 2020 14:52:13 -0700 (PDT) X-Google-Smtp-Source: APiQypJXHOFsGVbKV3+5YvfbSjAcSU+w35V5hDfVPpa+8JbdHEpRAIyJl80jpFJQL6ihB7EEN5KK X-Received: by 2002:aa7:cdce:: with SMTP id h14mr15993923edw.51.1587937933490; Sun, 26 Apr 2020 14:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587937933; cv=none; d=google.com; s=arc-20160816; b=CoGaloDJFkOo1llSuZF94J2/JlaGm69icedKUIijN3SsH1UpnhbLMXFHnJ59Ya+WgF tqTEgcw0QAOoSD1anLAbgvgLhpjZ657zbq6WRLD5fZ5lsmDdnc+HZV+9YAATo8mRfF7S 9jdZVP7IpbnSAPNDUcgcKspWVucMh3y8t3DYr9qpkPi9n/KOj1cqcUbIgUU4a9MEhaPE bLK2XbPIh5dxUXNBVgOcWVVN2XKUX2rjqRlT6vgEhma/zzR+k1cR2esRy/Cvl3ovtW08 Z7kII3b5XhRG6fJDLA8sMr0HA87M/o0rnPgTV4g+6TCuCnhksPp4ngnCShxPvhMdWpAw HQkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=qimnPXc/z1dTWaJyW3qhOlSkB0/PAvYb4yEUYXtkvBs=; b=vExiwLdfJCqDTGoqhyVuFqOK53wIXQMEIPt7o07l35vSvcd8ICEOAOYpEfDhBXYI1e earSi3YN3yQCG38jqQmeTQ3P1nPzHH3L4yYriXe3mPcNzVgGqNFKKEi1Bk8e7sPL+ncr jl0VcF+g3oSC5Gt7fhDCbxfmwwqtxHHQsRqURhNxmi4zgh4O/Tv27NP9v1abMtifuuMh IGq6TM60ZIOOCBxqUXCX6/6IyPEW82sQroG57+VdSVE4EkUH7YRuBYx94MVAle4cJX/+ CKosRvzypE/jrtU+bsRRn2I1AR++jyqYjyCzgGkwJsDUH2lHBx0tkSY8r7Yb/qQsUIfV a/tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=Gm5iEQRG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si7092456edf.299.2020.04.26.14.51.50; Sun, 26 Apr 2020 14:52:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=Gm5iEQRG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726479AbgDZVuL (ORCPT + 99 others); Sun, 26 Apr 2020 17:50:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726430AbgDZVt5 (ORCPT ); Sun, 26 Apr 2020 17:49:57 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB25BC061A0F for ; Sun, 26 Apr 2020 14:49:55 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id w2so12012590edx.4 for ; Sun, 26 Apr 2020 14:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qimnPXc/z1dTWaJyW3qhOlSkB0/PAvYb4yEUYXtkvBs=; b=Gm5iEQRGXjL2eUupRJ1Bh30r73SUBX84ADcBLaYreiF3hSkQEWeKNIEUgAFgJLtLMv wPfZtMjOqDacKdHwqWjWK8uVQ188OIkqVCt146DjBGGH399nUPOYIlJkSW4dfDknFdUF 7MZbSYWDEpgvMg69WJ+M7z5zshqFGp9auxPkebka7dLFCiHYBwsu5dsfZgALElUrvwf8 DMOqEwdKpZ2bPipHuh1KAjPEo3Qe2sEvSDGUJU0QwVaiR6GH/gZlDzprRcFZ2Ke6EyZ9 yUX9cBs8ilZZTyPKS+PUWadroC9CcJIR2cNNDoHBKSUR8zw2YRZtoZQ+7apQE5HafRd2 Sbfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qimnPXc/z1dTWaJyW3qhOlSkB0/PAvYb4yEUYXtkvBs=; b=t1vIvw5/UMw2afz+fWLSsvnJjA15OjHo2wypOCbrTHBE7x/Oi31gR+UORfmR+n5wFg Yg1W7x/cvvZAAtsrXv4iOGGJKvs2M8lUxIbLM4ddqWJ9XEPoHY3PyBvZBEsXONhgI5IW 3Gl9q7cPBgEPOva6ocEo6R8YLcsAUoTUnfFyf1o6btg9rDFK1+bjhLV5l4v/TH9Lek04 YVg3DA0XmDxk1Y3Y3Umoo0fpa3z+kh3egrBL2XtCJm0L9QRrbzC8otrTikMV5Xb/Khqo 9aP8lG/UCzp0w8ZvCkp34zfhzjEzig10tNpoUK/GSGx4yDDYQIPpKp6ZfAFgmjNrWuys k7eA== X-Gm-Message-State: AGi0PuawqIAT5fA3JAKZCmxfH/KP89dm/IlIow7RjGuTkO0gssuVVEg8 ITz2lcusXj1D8QiHe7Fp10iedQ== X-Received: by 2002:a50:c3c2:: with SMTP id i2mr15735367edf.93.1587937794634; Sun, 26 Apr 2020 14:49:54 -0700 (PDT) Received: from ls00508.pb.local ([2001:1438:4010:2540:fab1:56ff:feab:56b1]) by smtp.gmail.com with ESMTPSA id ce18sm2270108ejb.61.2020.04.26.14.49.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2020 14:49:54 -0700 (PDT) From: Guoqing Jiang To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: hch@infradead.org, david@fromorbit.com, willy@infradead.org, Guoqing Jiang , Mike Marshall , Martin Brandenburg , devel@lists.orangefs.org Subject: [RFC PATCH 8/9] orangefs: use set/clear_fs_page_private Date: Sun, 26 Apr 2020 23:49:24 +0200 Message-Id: <20200426214925.10970-9-guoqing.jiang@cloud.ionos.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200426214925.10970-1-guoqing.jiang@cloud.ionos.com> References: <20200426214925.10970-1-guoqing.jiang@cloud.ionos.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the new pair function is introduced, we can call them to clean the code in orangefs. Cc: Mike Marshall Cc: Martin Brandenburg Cc: devel@lists.orangefs.org Signed-off-by: Guoqing Jiang --- fs/orangefs/inode.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 12ae630fbed7..893099d36e20 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -64,9 +64,7 @@ static int orangefs_writepage_locked(struct page *page, } if (wr) { kfree(wr); - set_page_private(page, 0); - ClearPagePrivate(page); - put_page(page); + clear_fs_page_private(page); } return ret; } @@ -409,9 +407,7 @@ static int orangefs_write_begin(struct file *file, wr->len = len; wr->uid = current_fsuid(); wr->gid = current_fsgid(); - SetPagePrivate(page); - set_page_private(page, (unsigned long)wr); - get_page(page); + set_fs_page_private(page, wr); okay: return 0; } @@ -460,17 +456,13 @@ static void orangefs_invalidatepage(struct page *page, if (offset == 0 && length == PAGE_SIZE) { kfree((struct orangefs_write_range *)page_private(page)); - set_page_private(page, 0); - ClearPagePrivate(page); - put_page(page); + clear_fs_page_private(page); return; /* write range entirely within invalidate range (or equal) */ } else if (page_offset(page) + offset <= wr->pos && wr->pos + wr->len <= page_offset(page) + offset + length) { kfree((struct orangefs_write_range *)page_private(page)); - set_page_private(page, 0); - ClearPagePrivate(page); - put_page(page); + clear_fs_page_private(page); /* XXX is this right? only caller in fs */ cancel_dirty_page(page); return; @@ -537,9 +529,7 @@ static void orangefs_freepage(struct page *page) { if (PagePrivate(page)) { kfree((struct orangefs_write_range *)page_private(page)); - set_page_private(page, 0); - ClearPagePrivate(page); - put_page(page); + clear_fs_page_private(page); } } @@ -740,9 +730,7 @@ vm_fault_t orangefs_page_mkwrite(struct vm_fault *vmf) wr->len = PAGE_SIZE; wr->uid = current_fsuid(); wr->gid = current_fsgid(); - SetPagePrivate(page); - set_page_private(page, (unsigned long)wr); - get_page(page); + set_fs_page_private(page, wr); okay: file_update_time(vmf->vma->vm_file); -- 2.17.1