From patchwork Mon Jun 19 17:04:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9796917 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 F1FB8603F5 for ; Mon, 19 Jun 2017 17:05:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D75B61FF0B for ; Mon, 19 Jun 2017 17:05:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC3CB27F8F; Mon, 19 Jun 2017 17:05:20 +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 72C1127EE2 for ; Mon, 19 Jun 2017 17:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752026AbdFSRFT (ORCPT ); Mon, 19 Jun 2017 13:05:19 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:33826 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752592AbdFSRFQ (ORCPT ); Mon, 19 Jun 2017 13:05:16 -0400 Received: by mail-io0-f177.google.com with SMTP id i7so68375188ioe.1 for ; Mon, 19 Jun 2017 10:05: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=FS6cATz2kMgZtFoMJrW8UhNc1VjGS0B5xb2G921kQvM=; b=e+A1+I1JnNpS+4VeqTt4XvRH6FmEBlt7TqeJnsUW5C4ooKdwpQ+0MZCf1bX+wvr8Fw 3cLvuRdb62ggSQfVFILBmIf3dS3m2pXbFgIiKMIZCBlVZAvZ2xKFTf/NePrsIE47ZDaY +YaN2VUjO3lBLzKrHjiBiJRwUTOTetU9FnIbPw7leWzStWYVmF0QAhWyxPXv08MBNHXR /gHubkaINCnnz4g9zrV/OQ/sMDTQx9X/yXL2vRJSW0xzbJMtGj/NlSYsvm5RQPk1+d3J sZOk8z98bENgaDegixm2Q57TuHJ21YhplLyM/MZmXusi6b3GLTh6eorw1kYQ46c2swo4 3gnQ== 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=FS6cATz2kMgZtFoMJrW8UhNc1VjGS0B5xb2G921kQvM=; b=Al6GNSA49B78nuOKEW2d+7nEebIgahNoDd3Q0z/Z1zijrma47G0OozKn2JwCo5/bFf vSl/uvN0uSEXvSDYvcIq3+wIUXLvFTpmbtWQJSLoVjhv6zKvcoaHzthtZvYGgCWe/uk1 3/QnuVkk7q1v1OMlOq19UEFGSX7s4BcWIhEymdFjK5wPVpAos10Hje6manK07uiW6vd8 ZgY4Xhb5aGLaykqM0HUDQMKmeisutuWpJ+i5NjLwBtsV+81eydD7bVsFZzNSKJAPf5RF Q86xjtVwOe9fHL0EIVvJ+tgfnfZsWYldO9crM+VmZChAx2uBvgho4uQRMBBg1K3ChaL0 ploA== X-Gm-Message-State: AKS2vOxJqnKHVPfU6KG7wj0SmP3IgIQnl2T9E9T1ifAaperNNXEKGTem 4b+D7fwtlyFjZfJb X-Received: by 10.107.164.219 with SMTP id d88mr25362412ioj.157.1497891910400; Mon, 19 Jun 2017 10:05:10 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id 3sm6770522ith.7.2017.06.19.10.05.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Jun 2017 10:05:09 -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: Mon, 19 Jun 2017 11:04:57 -0600 Message-Id: <1497891902-25737-5-git-send-email-axboe@kernel.dk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497891902-25737-1-git-send-email-axboe@kernel.dk> References: <1497891902-25737-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 e8baaabebf13..9e9adca0c592 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 18f2f2b8ba2c..63b9f87d9461 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);