From patchwork Wed Mar 9 06:18:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satoru Takeuchi X-Patchwork-Id: 8542701 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 51DA19F38C for ; Wed, 9 Mar 2016 06:19:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6104420218 for ; Wed, 9 Mar 2016 06:19:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 33BCB20148 for ; Wed, 9 Mar 2016 06:19:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752517AbcCIGTT (ORCPT ); Wed, 9 Mar 2016 01:19:19 -0500 Received: from mgwym04.jp.fujitsu.com ([211.128.242.43]:13248 "EHLO mgwym04.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752511AbcCIGTS (ORCPT ); Wed, 9 Mar 2016 01:19:18 -0500 Received: from yt-mxq.gw.nic.fujitsu.com (unknown [192.168.229.66]) by mgwym04.jp.fujitsu.com with smtp id 4abe_6bb2_cf0cd066_e6c1_4a0e_93f1_e7300a34faac; Wed, 09 Mar 2016 15:19:10 +0900 Received: from m3051.s.css.fujitsu.com (m3051.s.css.fujitsu.com [10.134.21.209]) by yt-mxq.gw.nic.fujitsu.com (Postfix) with ESMTP id 6B4FEAC0126 for ; Wed, 9 Mar 2016 15:19:09 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.4.6 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20160122 X-SHieldMailCheckerMailID: 234f42588b7d4669a44d02692e4e058d To: "linux-btrfs@vger.kernel.org" From: Satoru Takeuchi Subject: [PATCH v3] Btrfs: Show a warning message if one of objectid reaches its highest value Message-ID: <56DFC051.1040409@jp.fujitsu.com> Date: Wed, 9 Mar 2016 15:18:57 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's better to show a warning message for the exceptional case that one of objectid (in most case, inode number) reaches its highest value. For example, if inode cache is off and this event happens, we can't create any file even if there are not so many files. This message ease detecting such problem. Signed-off-by: Satoru Takeuchi Reviewed-by: David Sterba --- This patch can be applied to 4.5-rc7 V3: - Show this message every time when hitting this problem for simplicity (thanks to the comment from Goffredo). - Reflect Naota's comment - Keep the error code as is. V2: - Reflect Filipe's comment - Use btrfs_warn() instead of WARN_ONCE() - Print the id of the tree --- fs/btrfs/inode-map.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index e50316c..5d97ee7 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c @@ -556,6 +556,9 @@ int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid) mutex_lock(&root->objectid_mutex); if (unlikely(root->highest_objectid >= BTRFS_LAST_FREE_OBJECTID)) { + btrfs_warn(root->fs_info, + "The objectid of root %llu reaches its highest value.\n", + root->root_key.objectid); ret = -ENOSPC; goto out; }