From patchwork Fri Mar 4 02:37:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satoru Takeuchi X-Patchwork-Id: 8497751 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B62C6C0553 for ; Fri, 4 Mar 2016 02:37:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF16420254 for ; Fri, 4 Mar 2016 02:37:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 195F120225 for ; Fri, 4 Mar 2016 02:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756798AbcCDCh0 (ORCPT ); Thu, 3 Mar 2016 21:37:26 -0500 Received: from mgwym01.jp.fujitsu.com ([211.128.242.40]:13232 "EHLO mgwym01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756636AbcCDChZ (ORCPT ); Thu, 3 Mar 2016 21:37:25 -0500 Received: from yt-mxauth.gw.nic.fujitsu.com (unknown [192.168.229.68]) by mgwym01.jp.fujitsu.com with smtp id 7164_5a98_b40f3c34_8044_4f9c_934f_d13b0fc210d9; Fri, 04 Mar 2016 11:37:18 +0900 Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by yt-mxauth.gw.nic.fujitsu.com (Postfix) with ESMTP id B52E9AC0A39 for ; Fri, 4 Mar 2016 11:37:15 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.4.6 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20160122 X-SHieldMailCheckerMailID: fdc9858f45344f3c8b6bcef3c57efa52 To: "linux-btrfs@vger.kernel.org" From: Satoru Takeuchi Subject: [PATCH] Show a warning message if one of highest objectid reaches its max value Message-ID: <56D8F4CF.20604@jp.fujitsu.com> Date: Fri, 4 Mar 2016 11:37:03 +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 highest objectid (in most case, inode number) reaches its max value, BTRFS_LAST_FREE_OBJECTID. Show this message only once to avoid filling dmesg with it. - EOVERFLOW is more proper return value for this case. ENOSPC is for "No space left on device" case and objectid isn't related to any device. Signed-off-by: Satoru Takeuchi --- This patch can be applied to v4.5-rc6 --- fs/btrfs/inode-map.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index e50316c..a4860fd 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c @@ -555,8 +555,10 @@ int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid) int ret; mutex_lock(&root->objectid_mutex); - if (unlikely(root->highest_objectid >= BTRFS_LAST_FREE_OBJECTID)) { - ret = -ENOSPC; + if (WARN_ONCE(root->highest_objectid >= BTRFS_LAST_FREE_OBJECTID, + "BTRFS: The highest objectid reaches its max value %llu.\n", + BTRFS_LAST_FREE_OBJECTID)) { + ret = -EOVERFLOW; goto out; }