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: 9809927 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 D09FE603F3 for ; Mon, 26 Jun 2017 15:38:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D46B328520 for ; Mon, 26 Jun 2017 15:38:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8EE22861B; Mon, 26 Jun 2017 15:38:17 +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 605EE28619 for ; Mon, 26 Jun 2017 15:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751582AbdFZPiP (ORCPT ); Mon, 26 Jun 2017 11:38:15 -0400 Received: from mail-io0-f179.google.com ([209.85.223.179]:34868 "EHLO mail-io0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520AbdFZPiO (ORCPT ); Mon, 26 Jun 2017 11:38:14 -0400 Received: by mail-io0-f179.google.com with SMTP id h134so2977527iof.2 for ; Mon, 26 Jun 2017 08:38:14 -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=b6VcQSITikd++V1RQTWz7MR9VmvF9Vxdskq8PF+95eFY8dstLt/CJCmVTT1lD+nLzM AhyMTBZPgvzem0ChFcxyMXNkai/Dgf178yAPjDJtzc4M+8LcvYKOofwKEg5tsoX3j+fq r0fmrIQIKSACOZCPQVshSoU3T4CYlZzaJldy9U7CsLfiYg1LYHU5dLfUN2vo1E7F+P6O iA6EEvYYCPr3gnEo5GAIEcJPQ0Pb19zYoNWY+rPDBNEm6WwiS2aNXmXivKmSkczNn25a a/A6Mg7K9YSnE4QZws9STaCMsNVhO0yu/dWRVuT8L+Ks/inwFWO/E9oc8RbeUqJa4/QT 6cpQ== X-Gm-Message-State: AKS2vOzpX5WFfxxfqsbbP3VOGPntf84j/bp1qaneKY0HfzJDilExw1HQ I4gTn2NdNZd21S/2iE99Kg== 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-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 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);