From patchwork Mon Nov 7 07:59:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoguang Wang X-Patchwork-Id: 9414421 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 BE30260720 for ; Mon, 7 Nov 2016 08:08:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEED228D77 for ; Mon, 7 Nov 2016 08:08:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3A1228D89; Mon, 7 Nov 2016 08:08:42 +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,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 23E4F28D87 for ; Mon, 7 Nov 2016 08:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752142AbcKGIHi (ORCPT ); Mon, 7 Nov 2016 03:07:38 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:56023 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752082AbcKGIGx (ORCPT ); Mon, 7 Nov 2016 03:06:53 -0500 X-IronPort-AV: E=Sophos;i="5.20,367,1444665600"; d="scan'208";a="948161" Received: from unknown (HELO cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 07 Nov 2016 16:06:40 +0800 Received: from localhost.localdomain (unknown [10.167.226.107]) by cn.fujitsu.com (Postfix) with ESMTP id 6371741B4BC3 for ; Mon, 7 Nov 2016 16:06:38 +0800 (CST) From: Wang Xiaoguang To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/2] btrfs: increase tickets_id even for failed metadata request Date: Mon, 7 Nov 2016 15:59:17 +0800 Message-Id: <1478505557-1406-2-git-send-email-wangxg.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1478505557-1406-1-git-send-email-wangxg.fnst@cn.fujitsu.com> References: <1478505557-1406-1-git-send-email-wangxg.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 6371741B4BC3.A34E6 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: wangxg.fnst@cn.fujitsu.com Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Not functional change, it just makes codes logic more reasonable, then at least tickets_id can reflect the number of metadata requests we already handled. Signed-off-by: Wang Xiaoguang --- fs/btrfs/extent-tree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 4607af3..d63bf40 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4949,14 +4949,16 @@ static inline int need_do_async_reclaim(struct btrfs_space_info *space_info, &root->fs_info->fs_state)); } -static void wake_all_tickets(struct list_head *head) +static void wake_all_tickets(struct btrfs_space_info *space_info) { struct reserve_ticket *ticket; + struct list_head *head = &space_info->tickets; while (!list_empty(head)) { ticket = list_first_entry(head, struct reserve_ticket, list); list_del_init(&ticket->list); ticket->error = -ENOSPC; + space_info->tickets_id++; wake_up(&ticket->wait); } } @@ -5018,7 +5020,7 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work) if (flush_state > COMMIT_TRANS) { commit_cycles++; if (commit_cycles > 2) { - wake_all_tickets(&space_info->tickets); + wake_all_tickets(space_info); space_info->flush = 0; } else { flush_state = FLUSH_DELAYED_ITEMS_NR;