Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp799307imm; Mon, 21 May 2018 14:42:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZriSCEiuZIdj9PDXAxyC0SNIKcWnfDTRezHQYWaqd9zBM7Seou9CyFglKGpfv7RRpHYs9CR X-Received: by 2002:a65:4188:: with SMTP id a8-v6mr17005305pgq.118.1526938927063; Mon, 21 May 2018 14:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526938927; cv=none; d=google.com; s=arc-20160816; b=Lb/de4mv188SmvgXxtC8OwU2iORjVOYMhRDyAr7isKQtA6YF1EGTxnwla64HM7++dn pkriiBYiszZqzqvUecjuhFpalrOTXZo3dRgw9ORH7jvACuakKNLzwgJEHfSB8BmMnt1E YhZPcOwL2NqUQnQHVrDUpV+2/x+mjuuid2kjoQI8WbItpY9Qg4q+dg+CKzB77B59tJfJ ibeZSIwT9iXYFVHcv7nl0NdSmHdzp/dF686uktQbSNX9e8yqZ2ktI8h2APgvhj8nKW/5 3aZOZyP5kGOFA/lfe35+/SuD+lB9zmheZ4LvyiuM+grywXiLJ705+iYivs6gkbCqi/Ab OStQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=NLGuh4Ro59Is53ThI875DC1rN0eeuCwyAzt8h18zAgU=; b=Jd++GW8f4naCqnKtL9EaDVfHnkcKAkVdbSfw9LnC/bbUycS0yecFbORjS469M7N1ck LujBxqAM7kfDRlDZYfzI99773LXcO5lbhaiKQdKwC+YndGaOQDJZVXY65aq/f8Elksb8 6R9ZKFrxtLxAphdZfJZG8CAxPB0n75cngJ1Bd3VwpRwMFobzXI3f1NOk3SC7n8EXh7Ux 1XqIzBilZWR4OSV/iCsbE//n16RhGNlh4o3AsGaHG03I53ZiZ+ryIQvf8G6CXTFtxR1B bURD/xs3D+6IDcKA5QssoKFtfASAun/9jr5Jm9CtxhwtCPrw2zECv4Xy5AKEzVLBSl+f LfXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BXoDhHZr; 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 u6-v6si14274435pfm.183.2018.05.21.14.41.52; Mon, 21 May 2018 14:42:07 -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=BXoDhHZr; 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 S932332AbeEUVYt (ORCPT + 99 others); Mon, 21 May 2018 17:24:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:39586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932302AbeEUVYn (ORCPT ); Mon, 21 May 2018 17:24:43 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 1EFE420853; Mon, 21 May 2018 21:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526937883; bh=78OjPpok+lCA4e/Nvsz6aLOFH06MzSyh7qNothBoozQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BXoDhHZrQbJTfzHA/v10u7St3M7/PWGCrYRiqyM1rtP5l/gK5NB3XtVclBGslZT7x mCdPZQ4/hBkMcLMoqsOM2+t1XFdfjMVO0td/E/3kSW4NRM26ySOIUw5tVcr1t6/lf1 +uuUwmqi/MuAYKUDtQxHmBS5pko0R7oKfCM4Sdvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , David Sterba , Anand Jain Subject: [PATCH 4.16 059/110] btrfs: Split btrfs_del_delalloc_inode into 2 functions Date: Mon, 21 May 2018 23:11:56 +0200 Message-Id: <20180521210511.174373366@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nikolay Borisov commit 2b8773313494ede83a26fb372466e634564002ed upstream. This is in preparation of fixing delalloc inodes leakage on transaction abort. Also export the new function. Signed-off-by: Nikolay Borisov Reviewed-by: David Sterba Reviewed-by: Anand Jain Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/ctree.h | 2 ++ fs/btrfs/inode.c | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3153,6 +3153,8 @@ noinline int can_nocow_extent(struct ino u64 *orig_start, u64 *orig_block_len, u64 *ram_bytes); +void __btrfs_del_delalloc_inode(struct btrfs_root *root, + struct btrfs_inode *inode); struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry); int btrfs_set_inode_index(struct btrfs_inode *dir, u64 *index); int btrfs_unlink_inode(struct btrfs_trans_handle *trans, --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1762,12 +1762,12 @@ static void btrfs_add_delalloc_inodes(st spin_unlock(&root->delalloc_lock); } -static void btrfs_del_delalloc_inode(struct btrfs_root *root, - struct btrfs_inode *inode) + +void __btrfs_del_delalloc_inode(struct btrfs_root *root, + struct btrfs_inode *inode) { struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb); - spin_lock(&root->delalloc_lock); if (!list_empty(&inode->delalloc_inodes)) { list_del_init(&inode->delalloc_inodes); clear_bit(BTRFS_INODE_IN_DELALLOC_LIST, @@ -1780,6 +1780,13 @@ static void btrfs_del_delalloc_inode(str spin_unlock(&fs_info->delalloc_root_lock); } } +} + +static void btrfs_del_delalloc_inode(struct btrfs_root *root, + struct btrfs_inode *inode) +{ + spin_lock(&root->delalloc_lock); + __btrfs_del_delalloc_inode(root, inode); spin_unlock(&root->delalloc_lock); }