From patchwork Wed Jul 22 07:58:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaolei X-Patchwork-Id: 6840811 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 550029F380 for ; Wed, 22 Jul 2015 07:59:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6EA1420632 for ; Wed, 22 Jul 2015 07:59:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F30B20631 for ; Wed, 22 Jul 2015 07:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933220AbbGVH7p (ORCPT ); Wed, 22 Jul 2015 03:59:45 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:60101 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932509AbbGVH7o (ORCPT ); Wed, 22 Jul 2015 03:59:44 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="98716433" Received: from bogon (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 22 Jul 2015 16:03:23 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t6M7vscr024884 for ; Wed, 22 Jul 2015 15:57:54 +0800 Received: from localhost.localdomain (10.167.226.114) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.181.6; Wed, 22 Jul 2015 15:59:41 +0800 From: Zhaolei To: CC: Zhao Lei Subject: [PATCH] btrfs-progs: Accurate errormsg for resize operation on no-enouth-free-space case Date: Wed, 22 Jul 2015 15:58:06 +0800 Message-ID: X-Mailer: git-send-email 1.8.5.1 MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 From: Zhao Lei btrfs progs output following error message when doing resize on no-enouth-free-space case: # btrfs filesystem resize +10g /mnt/btrfs_5gb Resize '/mnt/btrfs_5gb' of '+10g' ERROR: unable to resize '/mnt/btrfs_5gb' - File too large # It is not a good description for users, and this patch changed it to: # ./btrfs filesystem resize +10G /mnt/tmp1 Resize '/mnt/tmp1' of '+10G' ERROR: unable to resize '/mnt/tmp1' - no enouth free space # Reported-by: Taeha Kim Signed-off-by: Zhao Lei --- cmds-filesystem.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 800aa4d..c393ce7 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -1327,8 +1327,16 @@ static int cmd_resize(int argc, char **argv) e = errno; close_file_or_dir(fd, dirstream); if( res < 0 ){ - fprintf(stderr, "ERROR: unable to resize '%s' - %s\n", - path, strerror(e)); + switch (e) { + case EFBIG: + fprintf(stderr, "ERROR: unable to resize '%s' - no enouth free space\n", + path); + break; + default: + fprintf(stderr, "ERROR: unable to resize '%s' - %s\n", + path, strerror(e)); + break; + } return 1; } else if (res > 0) { const char *err_str = btrfs_err_str(res);