From patchwork Tue May 17 14:31:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 9112671 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 9684D9F1C3 for ; Tue, 17 May 2016 14:32:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B65A32022D for ; Tue, 17 May 2016 14:32:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F66B2021B for ; Tue, 17 May 2016 14:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755508AbcEQOcP (ORCPT ); Tue, 17 May 2016 10:32:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:41131 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751243AbcEQOcN (ORCPT ); Tue, 17 May 2016 10:32:13 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 75D15ACAE for ; Tue, 17 May 2016 14:32:07 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 89DA9DA8A1; Tue, 17 May 2016 16:31:41 +0200 (CEST) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH] btrfs-progs: device usage: report slack space Date: Tue, 17 May 2016 16:31:40 +0200 Message-Id: <1463495500-14983-1-git-send-email-dsterba@suse.com> X-Mailer: git-send-email 2.7.1 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.3 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 The total filesystem space on a given device might be smaller than the device size. We should report that space as well. The original idea was to report the 'occupied' size but the term was not all clear, so the logic was reversed to report the slack space. Signed-off-by: David Sterba --- cmds-fi-usage.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c index 23820066ce26..b26ece1d2ece 100644 --- a/cmds-fi-usage.c +++ b/cmds-fi-usage.c @@ -1024,13 +1024,8 @@ void print_device_sizes(int fd, struct device_info *devinfo, unsigned unit_mode) printf(" Device size: %*s%10s\n", (int)(20 - strlen("Device size")), "", pretty_size_mode(devinfo->device_size, unit_mode)); -#if 0 - /* - * The term has not seen an agreement and we don't want to change it - * once it's in non-development branches or even released. - */ - printf(" FS occupied: %*s%10s\n", - (int)(20 - strlen("FS occupied")), "", - pretty_size_mode(devinfo->size, unit_mode)); -#endif + printf(" Device slack: %*s%10s\n", + (int)(20 - strlen("Device slack")), "", + pretty_size_mode(devinfo->device_size - devinfo->size, + unit_mode)); }