Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3786832ybi; Mon, 29 Jul 2019 12:36:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqx56O1hv0MPPxTufgYYiv8w/no/FhxcwtHNvCWQfGGP1Cl25m0GCRZbfM9FDSNvT84Qybza X-Received: by 2002:a63:fe15:: with SMTP id p21mr106916781pgh.149.1564428987755; Mon, 29 Jul 2019 12:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428987; cv=none; d=google.com; s=arc-20160816; b=cODmw3kLoZr9hs9Eo5Vew93MWpi2tSO4EHsTQRjEZlFClm1poYs3GRxJJyBMqXkYS5 hHC+/jaywRwfavVW4kt04rJTwJjUAPyy8r6iVPn1BSg1pJgl4xiQyOSaVj3yK0LQveff NFWqzBtBOOf15V6ou/swmLvFdwPpfdnDgX4jBZHYIw4JRatwql8NrZmDfKD8sLfKwXP/ s5jLqtKNtDh4d5jkxBv5U1ebQHAJAhtSKsAofw3TlmfSKyfqCBHW9YrG+XP63Uyet3uo DrMYuUEXpSdzHBjCgd8N8D6eBm83Nm6/8wkLlwQXcQKCMjBGlUbf/vxa31tufgypxucN 61vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DDq5X+RaV6n7SPaKrcGTNJS/i8uagADYYeaKRjXV9Co=; b=OF2nJoWYocfp5q6GIsUCMmGeKn0Gd8iRF+o1IT0DExvdcwKRQJ37Lf5CExki5jJEYx hKIOj1jjy0y/zgivFN1YndQzRAvrk7RPzVy+dQB2caqJRCusSgP9ORjm6E2VExBo8iel ChhDkfgtButPPmMNdffJ2gG1zmAG4/uVWmG4nLABvBEGYSoVxK3CGiQgOM1YJYiE+UL4 wl+C3dPWatshHeLQpJXAHUF6mXLOnMNKJ6oSfW5z9Dt9K7XxYznxq/IxnI9nek95ATcA fMfCI4QqXALGHtsOgfjV1i9LYyQws4n0bU+aBIdJIS/d8l01p3w+4t/mjJrZhf5r0jtH a7uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ND7pr93K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si26524627pfg.55.2019.07.29.12.36.12; Mon, 29 Jul 2019 12:36:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ND7pr93K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388459AbfG2Tef (ORCPT + 99 others); Mon, 29 Jul 2019 15:34:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:48892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388446AbfG2Teb (ORCPT ); Mon, 29 Jul 2019 15:34:31 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6158B2171F; Mon, 29 Jul 2019 19:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428869; bh=ItaiDneyzVoTv3qjq7MuM6mtz8MIKKdHSZqu5PLeKSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ND7pr93K997W8kvDv7eP6ewVDeU/urIjnVfKPk+KlkjsekRx4nbYnjjzV5vaxK+Nm k/5WhZhnMsCCGn2+n167ybOimFTS/cfvG9iWsTRYttTMv5PZy4QRDcRuFHef9CWNau RT5/QasWCA+tkxHWgObb3H+MSHsFgEZoqUpaD6io= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ross Zwisler , Theodore Tso , Jan Kara Subject: [PATCH 4.14 212/293] ext4: use jbd2_inode dirty range scoping Date: Mon, 29 Jul 2019 21:21:43 +0200 Message-Id: <20190729190840.707790839@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ross Zwisler commit 73131fbb003b3691cfcf9656f234b00da497fcd6 upstream. Use the newly introduced jbd2_inode dirty range scoping to prevent us from waiting forever when trying to complete a journal transaction. Signed-off-by: Ross Zwisler Signed-off-by: Theodore Ts'o Reviewed-by: Jan Kara Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/ext4_jbd2.h | 12 ++++++------ fs/ext4/inode.c | 13 ++++++++++--- fs/ext4/move_extent.c | 3 ++- 3 files changed, 18 insertions(+), 10 deletions(-) --- a/fs/ext4/ext4_jbd2.h +++ b/fs/ext4/ext4_jbd2.h @@ -364,20 +364,20 @@ static inline int ext4_journal_force_com } static inline int ext4_jbd2_inode_add_write(handle_t *handle, - struct inode *inode) + struct inode *inode, loff_t start_byte, loff_t length) { if (ext4_handle_valid(handle)) - return jbd2_journal_inode_add_write(handle, - EXT4_I(inode)->jinode); + return jbd2_journal_inode_ranged_write(handle, + EXT4_I(inode)->jinode, start_byte, length); return 0; } static inline int ext4_jbd2_inode_add_wait(handle_t *handle, - struct inode *inode) + struct inode *inode, loff_t start_byte, loff_t length) { if (ext4_handle_valid(handle)) - return jbd2_journal_inode_add_wait(handle, - EXT4_I(inode)->jinode); + return jbd2_journal_inode_ranged_wait(handle, + EXT4_I(inode)->jinode, start_byte, length); return 0; } --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -728,10 +728,16 @@ out_sem: !(flags & EXT4_GET_BLOCKS_ZERO) && !ext4_is_quota_file(inode) && ext4_should_order_data(inode)) { + loff_t start_byte = + (loff_t)map->m_lblk << inode->i_blkbits; + loff_t length = (loff_t)map->m_len << inode->i_blkbits; + if (flags & EXT4_GET_BLOCKS_IO_SUBMIT) - ret = ext4_jbd2_inode_add_wait(handle, inode); + ret = ext4_jbd2_inode_add_wait(handle, inode, + start_byte, length); else - ret = ext4_jbd2_inode_add_write(handle, inode); + ret = ext4_jbd2_inode_add_write(handle, inode, + start_byte, length); if (ret) return ret; } @@ -4004,7 +4010,8 @@ static int __ext4_block_zero_page_range( err = 0; mark_buffer_dirty(bh); if (ext4_should_order_data(inode)) - err = ext4_jbd2_inode_add_write(handle, inode); + err = ext4_jbd2_inode_add_write(handle, inode, from, + length); } unlock: --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -400,7 +400,8 @@ data_copy: /* Even in case of data=writeback it is reasonable to pin * inode to transaction, to prevent unexpected data loss */ - *err = ext4_jbd2_inode_add_write(handle, orig_inode); + *err = ext4_jbd2_inode_add_write(handle, orig_inode, + (loff_t)orig_page_offset << PAGE_SHIFT, replaced_size); unlock_pages: unlock_page(pagep[0]);