From patchwork Wed Jun 21 00:22:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9800471 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 68C316038C for ; Wed, 21 Jun 2017 00:22:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 587E62846B for ; Wed, 21 Jun 2017 00:22:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CDFD28426; Wed, 21 Jun 2017 00:22:30 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable 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 2F7E728426 for ; Wed, 21 Jun 2017 00:22:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752865AbdFUAWV (ORCPT ); Tue, 20 Jun 2017 20:22:21 -0400 Received: from mail-pg0-f46.google.com ([74.125.83.46]:35651 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752838AbdFUAWR (ORCPT ); Tue, 20 Jun 2017 20:22:17 -0400 Received: by mail-pg0-f46.google.com with SMTP id 132so36021482pgb.2 for ; Tue, 20 Jun 2017 17:22:17 -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=if0ZUXzQTjgUiBuTNxBkSBOqPGInsMl4l/p70Bt8PEU=; b=huYyYsDevq1kEtkwH+4OAnS6yDobtKrQbj9nOP4DgNuA8eVUBCn39gps2EypLv9qvE uEzDoq/ciiRWTbyKhHFjCUoB91iHB2gM3zWeCXzJXTEr8T1acpJBzWVTg8ZH0JWFv9VG /eFcF8oinXpjcGj40Ze6c0mD1gsO7rLie2lk5XX92C9JDgUvSP0sSavi6HCDnI3GunVr yR63qLdxTf6mmowdKEBEQu/7JwkbzuQPjPdl7j/vFm+/18eLMyrpldty2UPVul+7CiFL otK6EgKB5xlAkA/THMzbWfiNUPKQjMZznoH2FztcMN06ClhdjjOv6F/EE7rG2n5huAn8 ftqg== 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=if0ZUXzQTjgUiBuTNxBkSBOqPGInsMl4l/p70Bt8PEU=; b=GW90Z4PPMiN8gGrCE4IdhDkKWb8+OlXQqXN0htDurkdRr13YU0yv4P3Gg96eIzNZZ1 kems6qf5BjAtci80aimm4p7V4GnrmnxffBhXgawwyFS4A4V/WiAjVOEyLCOSID4Z1B0c QzLHyrLWC2l4cMUms2pHjtagpbWxPd9P6PagwyK1JJbGsyeJMqWFMHI5SaolX/kTFQ7v A1qC717q3yePodctk28BBw9xbKzLanmiabiN6PYvnHLR121l4C7Kr+MLfapMm/HTrZr2 nHrGTTgfnTpBiYyTDTqKBEt2E0s+s5WtTj9Xuq99jnvO8uOkqzsREcbPyX8Gi+woRnhy 85jQ== X-Gm-Message-State: AKS2vOxFdv1kMcHVwdjqznvD8Yc7XJkHWHrJUQ4iJsbPMyXIbf7X5F0i /VPLr3HEhFZzVhiYwXefLw== X-Received: by 10.84.231.130 with SMTP id g2mr39309093plk.2.1498004536560; Tue, 20 Jun 2017 17:22:16 -0700 (PDT) Received: from localhost.localdomain (66.29.164.166.static.utbb.net. [66.29.164.166]) by smtp.gmail.com with ESMTPSA id f10sm13447835pfd.69.2017.06.20.17.22.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 17:22:15 -0700 (PDT) From: Jens Axboe To: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: adilger@dilger.ca, hch@infradead.org, martin.petersen@oracle.com, linux-nvme@lists.infradead.org, Jens Axboe Subject: [PATCH 5/9] fs: add support for buffered writeback to pass down write hints Date: Tue, 20 Jun 2017 18:22:02 -0600 Message-Id: <1498004526-4543-6-git-send-email-axboe@kernel.dk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498004526-4543-1-git-send-email-axboe@kernel.dk> References: <1498004526-4543-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 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..1259524715c8 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 stream, 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..d8a750873bf4 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 |= write_hint_to_opf(inode_write_hint(inode)); } /*