From patchwork Tue Feb 28 14:57:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9595901 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 34368601D7 for ; Tue, 28 Feb 2017 14:58:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29B2F28497 for ; Tue, 28 Feb 2017 14:58:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E5D5284FF; Tue, 28 Feb 2017 14:58: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 B813128497 for ; Tue, 28 Feb 2017 14:58:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752471AbdB1O6Z (ORCPT ); Tue, 28 Feb 2017 09:58:25 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:57751 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752134AbdB1O6E (ORCPT ); Tue, 28 Feb 2017 09:58:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iGcJbK/+hwsx+Z2cx6pMWl/m2zvAXpMeYw6M2qA3uE8=; b=aKM915yaEXUDfukhrChBL3dVt tZp1X6K45O6o/Fk/CqnoFGg4v/jXv6c/3zO7sTFZu0SMeaDmg8fFVEO3ba1dPC96rFLLg54vp1DGa YSJl38bUQQpHBEcZ2hXGZGdUzRHina4PLzsW7Z7JGoAdtF67Fk8x4qCEA3Qg5ptg1xwUYGEHVcpZC 6uxbq0paV78AFhVsYrhf+SahoNZK1QWyzhPkA1DY2xOWEYTNHMI2nZa6auu2DxDDy11vt1fh2se9E H3R/uZoxlRMZGAP6/K95gUNhlogfiK8/wkSmbuQUAW1C7XbPg//ulylj1r7+29PeSiGRwEsjPu3ci 1Y2WA8pXw==; Received: from [8.25.222.2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cijDe-0006SA-VR; Tue, 28 Feb 2017 14:57:39 +0000 From: Christoph Hellwig To: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 10/12] block_dev: set REQ_NOMERGE for O_ATOMIC writes Date: Tue, 28 Feb 2017 06:57:35 -0800 Message-Id: <20170228145737.19016-11-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170228145737.19016-1-hch@lst.de> References: <20170228145737.19016-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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 Signed-off-by: Christoph Hellwig --- fs/block_dev.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index 3c47614a4b32..4dd5c54cdefb 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -242,6 +242,10 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, task_io_account_write(ret); } + /* don't merge atomic requests to avoid going over the limit */ + if (iocb->ki_filp->f_flags & O_ATOMIC) + bio.bi_opf |= REQ_NOMERGE; + qc = submit_bio(&bio); for (;;) { set_current_state(TASK_UNINTERRUPTIBLE); @@ -377,6 +381,10 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) task_io_account_write(bio->bi_iter.bi_size); } + /* don't merge atomic requests to avoid going over the limit */ + if (iocb->ki_filp->f_flags & O_ATOMIC) + bio->bi_opf |= REQ_NOMERGE; + dio->size += bio->bi_iter.bi_size; pos += bio->bi_iter.bi_size;