From patchwork Mon Jun 26 15:37:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9809931 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 01D77603D7 for ; Mon, 26 Jun 2017 15:38:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 067A828619 for ; Mon, 26 Jun 2017 15:38:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF31C2861B; Mon, 26 Jun 2017 15:38:19 +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=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 D494328619 for ; Mon, 26 Jun 2017 15:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751630AbdFZPiR (ORCPT ); Mon, 26 Jun 2017 11:38:17 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:36731 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751431AbdFZPiO (ORCPT ); Mon, 26 Jun 2017 11:38:14 -0400 Received: by mail-io0-f177.google.com with SMTP id z62so2942919ioi.3 for ; Mon, 26 Jun 2017 08:38:13 -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=yjibfB6uDE+bPcdW61pFcnnI7opA0n6Yj39a6dy0NlY=; b=MVjYuVlauJHBkdY6fwERpZ76Pgoar+6xGYfaUMrgMPD58pskJREmFllX4KTV8ZAD99 N3w3Fmewa2/3vmqSeGKrLTN43ZJ3GtT9FwFFQcm3QxARK6MWttSYG6u9FBPVoUQUvi4D dJzBEhnWjCYct+7mv22JxodMicN1Ne8be039aTxfUxjevhyRjLncZGRP8IDzNGn2DD0M UdynUgzR/KAY595L+KJyE40WJmXj+3yhvKHfyv/IW6zoclGur2eg5bRw/245X9OL+hxj pcSY6KMQjNP3VF6rYJ9UYJk5VScMEHzCPIIBdfzhzcw8rX9sNMZAti9SC2ZYv0hsaiAv KtZg== 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=yjibfB6uDE+bPcdW61pFcnnI7opA0n6Yj39a6dy0NlY=; b=U+SYfugFs6NFtEmfJ6RNfZGQ8EbwkjR9DObUsS67n4ipnbX+tJ7QrTAT7UmOH4gnyE YHvUL+Gn5tSNjG/ssvY61nwUcrZjJt2EnhdyrUst1GyRrzmC+9rS9ALLtbNPTYSotVwa jToKWAXXkWRS60hWHZw9QTMuUNExx7s8qG4jDPZNUHd2clwR4Yq1RkNjOX+BpDSoWWjx lftom6IuZ9WMEBLxXM8wQUpazpg/b4Zr0acTq4hxpNq64ZXAsoRCE++mADkYfK24ozQ0 pYbEHXFMQiwJoQoX+19yPkuxHhswBn5EWmDt+1aBjeNPvhxn2UjF7EzH6qHfthykhprX t6cA== X-Gm-Message-State: AKS2vOzfBakpwRAReJlOjfQOhKKfmR7+bdkDakAfL+D72+pfVNLzoj+J Ub++YUFl9g+Bx19H X-Received: by 10.107.134.141 with SMTP id q13mr906117ioi.191.1498491493281; Mon, 26 Jun 2017 08:38:13 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id b69sm33425itb.23.2017.06.26.08.38.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Jun 2017 08:38:12 -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 4/9] fs: add O_DIRECT support for sending down write life time hints Date: Mon, 26 Jun 2017 09:37:55 -0600 Message-Id: <1498491480-16306-5-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/block_dev.c | 2 ++ fs/direct-io.c | 2 ++ fs/iomap.c | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) 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..42d4ecf3ba54 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -803,7 +803,10 @@ 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_set_op_attrs(bio, REQ_OP_WRITE, + REQ_SYNC | REQ_IDLE); + bio->bi_opf |= + write_hint_to_opf(iocb_write_hint(dio->iocb)); task_io_account_write(bio->bi_iter.bi_size); } else { bio_set_op_attrs(bio, REQ_OP_READ, 0);