From patchwork Mon Jun 26 15:37:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9809939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EBCE4603D7 for ; Mon, 26 Jun 2017 15:38:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF9FE2863A for ; Mon, 26 Jun 2017 15:38:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E483428641; Mon, 26 Jun 2017 15:38:29 +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=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 837DB2861B for ; Mon, 26 Jun 2017 15:38:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751755AbdFZPiY (ORCPT ); Mon, 26 Jun 2017 11:38:24 -0400 Received: from mail-io0-f173.google.com ([209.85.223.173]:33705 "EHLO mail-io0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751552AbdFZPiP (ORCPT ); Mon, 26 Jun 2017 11:38:15 -0400 Received: by mail-io0-f173.google.com with SMTP id h64so2994675iod.0 for ; Mon, 26 Jun 2017 08:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=chNyQjEId7fB6d2pOrDedYEtuMFlN6T2mXqMcUo3b2U=; b=O1bA6PbpZlJecxQk1YWhS3s8o+jp00Lua1Jby0Ic8onhEkWYtaldRqudcnLEeeEonG 9FyXCWSX1PHAl77yNYIts8u7/nANvk9RzT/8zh0H9/VbE83hjDFEWJ0V86f0KGDMmOTV yJWH3TfLoXEaWn/AVenpqgVcv5M+ZzxjGajx41Fv0zf5HQsHYTcJgFmqV8yXSBBeaCyU UMEUL0ekZnpa/0cgAezQVDmj1QV5GfmH5gZAwFy4SAPkJSmdp9QN4xKLu01rds4bK8vm 5UdAjdzUlTHmehbAuG5yzKxBH16mSMbQA4Z/5h2IbQlZ+Hrgwg5jVmccKHXDuAYWnQnW xwUg== 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=chNyQjEId7fB6d2pOrDedYEtuMFlN6T2mXqMcUo3b2U=; b=VlxW6E+HQ8laA3G3H3H7E9hZKl9Z4qX7jrWENT1RRO79w9+qvGOWEBfjfWEHtJXhbJ fV/CwqBVrnXCrJzujWBZHucWH3Iz9OKKc9Xd64JmMGuXorTq2/H5bQxu50NMNdKzRfWW EcrH9GdvvS+AXwf8wSnFlwJgBYqKKcuRt4tDf7MIA1aA0XLU7lgC3qn4ehg+wt5MKVCr RbCMlyxQD0j+XnTKk+eNVXuJoV3Srqr4Lil1R3BnPXCPXBDBqOMkMwMI7O7Rs0mkw25p KFOAumxIa4+mXmTKHyDIDK/7kqsN3D2NYOU/3zvZS9XqNdVBCts0m01kZ5TM++wbvM4B HEBw== X-Gm-Message-State: AKS2vOz++Xysyzl3NDoAmYLD9F1iuZ++Y7gsA4dLGF3tmdOxqq0/4mJz 7UgJi21599PQFFdm3gzUqw== X-Received: by 10.107.176.140 with SMTP id z134mr985679ioe.76.1498491494616; Mon, 26 Jun 2017 08:38:14 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id b69sm33425itb.23.2017.06.26.08.38.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Jun 2017 08:38:13 -0700 (PDT) From: Jens Axboe To: linux-block@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, hch@lst.de, martin.petersen@oracle.com, Jens Axboe Subject: [PATCH 5/9] fs: add support for buffered writeback to pass down write hints Date: Mon, 26 Jun 2017 09:37:56 -0600 Message-Id: <1498491480-16306-6-git-send-email-axboe@kernel.dk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498491480-16306-1-git-send-email-axboe@kernel.dk> References: <1498491480-16306-1-git-send-email-axboe@kernel.dk> 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 Reviewed-by: Andreas Dilger Reviewed-by: Martin K. Petersen Signed-off-by: Jens Axboe --- fs/buffer.c | 14 +++++++++----- fs/mpage.c | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 306b720f7383..307b508c9d60 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -49,7 +49,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, - struct writeback_control *wbc); + unsigned int hint, struct writeback_control *wbc); #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers) @@ -1829,7 +1829,8 @@ int __block_write_full_page(struct inode *inode, struct page *page, do { struct buffer_head *next = bh->b_this_page; if (buffer_async_write(bh)) { - submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, wbc); + submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, + inode_write_hint(inode), wbc); nr_underway++; } bh = next; @@ -1883,7 +1884,8 @@ int __block_write_full_page(struct inode *inode, struct page *page, struct buffer_head *next = bh->b_this_page; if (buffer_async_write(bh)) { clear_buffer_dirty(bh); - submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, wbc); + submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, + inode_write_hint(inode), wbc); nr_underway++; } bh = next; @@ -3091,7 +3093,7 @@ void guard_bio_eod(int op, struct bio *bio) } static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, - struct writeback_control *wbc) + unsigned int write_hint, struct writeback_control *wbc) { struct bio *bio; @@ -3134,6 +3136,8 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, op_flags |= REQ_META; if (buffer_prio(bh)) op_flags |= REQ_PRIO; + + op_flags |= write_hint_to_opf(write_hint); bio_set_op_attrs(bio, op, op_flags); submit_bio(bio); @@ -3142,7 +3146,7 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, int submit_bh(int op, int op_flags, struct buffer_head *bh) { - return submit_bh_wbc(op, op_flags, bh, NULL); + return submit_bh_wbc(op, op_flags, bh, 0, NULL); } EXPORT_SYMBOL(submit_bh); diff --git a/fs/mpage.c b/fs/mpage.c index 9524fdde00c2..07587fd6debf 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -615,6 +615,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, goto confused; wbc_init_bio(wbc, bio); + bio->bi_opf |= inode_hint_to_opf(inode); } /*