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: 9800459 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 8575F60886 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 7510C28488 for ; Wed, 21 Jun 2017 00:22:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A2CC284B2; 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=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 0C44F28471 for ; Wed, 21 Jun 2017 00:22:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752844AbdFUAWW (ORCPT ); Tue, 20 Jun 2017 20:22:22 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:34822 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752515AbdFUAWQ (ORCPT ); Tue, 20 Jun 2017 20:22:16 -0400 Received: by mail-pf0-f174.google.com with SMTP id c73so16661283pfk.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=lFdnTQ5boicYeMHgVS1y3vPwHUaYiqe3V9wydgjCMQJ2M2qRFHiQAAanp+6kwjEtN5 rrXOg2Y/lcb23FS1LIkm2MoVvUNSf5YBE66yQUEa9lYGdnVDqSZ2G1g0owC5kifvmD69 C40VHiuZzvp07ZVclyv4VAOeJNlEQHHTcLmHKLgEREouMCWWiLLpVH/NC/hg6PokfouU 48wXyqdk9UqvfDEAOoQS59Fq+mVnzs0JyrS3EKbOXfnpx+y7QU/X4c0SpsKI01m3HDLW 4G7jCaCSDRpXwxUo8DXvpZVLboObqL9brlPEFAnUbOue8UImdeRYN9l9WwXVPHMhAkrY L4uw== X-Gm-Message-State: AKS2vOwIH7nNc711hwGQqt+B0Afq94HYoXq90UfzdcKUfURT8RfxGP1s S1/6Hv9gi9uxnA/nFVSp3Q== 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-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/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);