From patchwork Wed Jun 21 00:22:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9800463 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 B7E4660887 for ; Wed, 21 Jun 2017 00:22:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A726528471 for ; Wed, 21 Jun 2017 00:22:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 987572849E; Wed, 21 Jun 2017 00:22:28 +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 4D5672849E for ; Wed, 21 Jun 2017 00:22:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752883AbdFUAWX (ORCPT ); Tue, 20 Jun 2017 20:22:23 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:34821 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752377AbdFUAWP (ORCPT ); Tue, 20 Jun 2017 20:22:15 -0400 Received: by mail-pf0-f179.google.com with SMTP id c73so16661256pfk.2 for ; Tue, 20 Jun 2017 17:22: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=esBSGFguF2TrujJIMd4DygzgZSmxpDBb/kW40bU+eP8=; b=Z3sSAEl8Bq/PFl82XEzj4pPGZ2LcmAAtFLDhz61QYkQYVKqh/J0C0fFkxYY4EubrPk 6UA0AK9Z0ce8DmIHUFfakU0yL28hJy0u5nsEIEoRvbH3lah4LXAm/WGMTwTG92sQr0Ce 3dqSRKRq5nK9bEhEN/AzE4RZDqQDOgIKxpabTXicLRQP9lI7w4R8Bnls8PbQ35dZVA6b z71GLztMIWuZf6rhZ09t0ROrieBYWErsqPbd48NKVsgzrgCf7ppOKHMUhkOQ4RR5Z+IE SYFLXd7L7h6yB09DbpNgBqXND60pVDU/Rg8jrNrjcZh2AywYMHf+zEuIaWLfQS0tV61D AG/A== 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=esBSGFguF2TrujJIMd4DygzgZSmxpDBb/kW40bU+eP8=; b=i5xDRCTjxSAvCYHl6AgHa/5I2YLjJ6b+4H+oVRg+vcAdk9kDb5tfIILLN03hdp7IAl 89+38kLC8l0tEE1So4TM9YHrk3aDozogWN8HUvb2NA6GlDiKlY/oxjqSCRJLIQK6w+Ee fryNEVQjgPN7N1epToqj4zoR6rI6lsIYJ3zpV4T7etOhN4lOLd3ho7RJgFS8NBg/idLK ad5eI6K5ag1SpXfVjXltp5vbOHoQz6izS16DfCx8sCKDm6FP2JuuQzCTYpwrHya8MtIz UnJMeHaPDrtO2UfXwdQozwlvzxFHsvJiuY5TawvVWya4d3pWbm1/RQrhB8Yf03ev38jg asIg== X-Gm-Message-State: AKS2vOwNnd+kIIa4ikPhWFpX4ZHEC89Ij6u6uJgSv9RprfWvWIVdYWYx QGPI2JJCsv6dVTUS X-Received: by 10.98.66.77 with SMTP id p74mr14761007pfa.240.1498004535232; Tue, 20 Jun 2017 17:22:15 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 17:22:14 -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 4/9] fs: add O_DIRECT support for sending down write life time hints Date: Tue, 20 Jun 2017 18:22:01 -0600 Message-Id: <1498004526-4543-5-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-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Andreas Dilger Signed-off-by: Jens Axboe --- fs/block_dev.c | 2 ++ fs/direct-io.c | 2 ++ fs/iomap.c | 1 + 3 files changed, 5 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index dd91c99e9ba0..30e1fb65c2fa 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -183,6 +183,8 @@ static unsigned int dio_bio_write_op(struct kiocb *iocb) /* avoid the need for a I/O completion work item */ if (iocb->ki_flags & IOCB_DSYNC) op |= REQ_FUA; + + op |= write_hint_to_opf(iocb_write_hint(iocb)); return op; } diff --git a/fs/direct-io.c b/fs/direct-io.c index c87077d1dc33..5fea570551e5 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -385,6 +385,8 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio, else bio->bi_end_io = dio_bio_end_io; + bio->bi_opf |= write_hint_to_opf(iocb_write_hint(dio->iocb)); + sdio->bio = bio; sdio->logical_offset_in_bio = sdio->cur_page_fs_offset; } diff --git a/fs/iomap.c b/fs/iomap.c index c71a64b97fba..9c9f8406018b 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -804,6 +804,7 @@ iomap_dio_actor(struct inode *inode, loff_t pos, loff_t length, if (dio->flags & IOMAP_DIO_WRITE) { bio_set_op_attrs(bio, REQ_OP_WRITE, REQ_SYNC | REQ_IDLE); + bio->bi_opf |= write_hint_to_opf(inode_write_hint(inode)); task_io_account_write(bio->bi_iter.bi_size); } else { bio_set_op_attrs(bio, REQ_OP_READ, 0);