From patchwork Mon Nov 26 09:46:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10697913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DD355A4 for ; Mon, 26 Nov 2018 09:46:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F17332979D for ; Mon, 26 Nov 2018 09:46:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5CF42979F; Mon, 26 Nov 2018 09:46:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A223C2979D for ; Mon, 26 Nov 2018 09:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726441AbeKZUj5 (ORCPT ); Mon, 26 Nov 2018 15:39:57 -0500 Received: from relay.sw.ru ([185.231.240.75]:49798 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbeKZUj4 (ORCPT ); Mon, 26 Nov 2018 15:39:56 -0500 Received: from [172.16.25.169] (helo=localhost.localdomain) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gRDTA-0007C0-Rn; Mon, 26 Nov 2018 12:46:21 +0300 Subject: [PATCH 2/2] fuse: Replace page without copying in fuse_writepage_in_flight() From: Kirill Tkhai To: miklos@szeredi.hu, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 26 Nov 2018 12:46:20 +0300 Message-ID: <154322557765.18737.14337090699283695815.stgit@localhost.localdomain> In-Reply-To: <154322517208.18737.3297786654135648324.stgit@localhost.localdomain> References: <154322517208.18737.3297786654135648324.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It looks like we can optimize old_req page replacement and avoid copying by simple updating the request's page. Signed-off-by: Kirill Tkhai --- fs/fuse/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index c6650c68b31a..83b54b082c86 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1778,7 +1778,7 @@ static bool fuse_writepage_in_flight(struct fuse_req *new_req, if (old_req->num_pages == 1 && old_req != first_req) { struct backing_dev_info *bdi = inode_to_bdi(page->mapping->host); - copy_highpage(old_req->pages[0], page); + swap(old_req->pages[0], page); spin_unlock(&fc->lock); dec_wb_stat(&bdi->wb, WB_WRITEBACK);