From: Eric Sandeen <sandeen@sandeen.net>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: sandeen@redhat.com, linux-xfs@vger.kernel.org,
Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH 7/9] xfs_spaceman: Free space mapping command
Date: Tue, 30 May 2017 13:56:39 -0500 [thread overview]
Message-ID: <d2defe9d-643e-109c-e070-c25c79f5d6fe@sandeen.net> (raw)
In-Reply-To: <20170530184041.GA4519@birch.djwong.org>
On 5/30/17 1:40 PM, Darrick J. Wong wrote:
> On Fri, May 26, 2017 at 08:57:14PM -0500, Eric Sandeen wrote:
>>
>>
>> On 5/7/17 10:57 AM, Darrick J. Wong wrote:
>>> From: Dave Chinner <dchinner@redhat.com>
>>>
>>> Add freespace mapping tool modelled on the xfs_db freesp command.
>>> The advantage of this command over xfs_db is that it can be done
>>> online and is coherent with concurrent modifications to the
>>> filesystem.
>>>
>>> This requires the kernel to support the XFS_IOC_GETFSMAP ioctl to map
>>> free space indexes.
>>>
>>> Signed-off-by: Dave Chinner <dchinner@redhat.com>
>>> [darrick: port from FIEMAPFS to GETFSMAP]
>>> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
>>> ---
>>> spaceman/Makefile | 12 +-
>>> spaceman/ag.c | 1
>>> spaceman/file.c | 18 ++-
>>> spaceman/freesp.c | 367 +++++++++++++++++++++++++++++++++++++++++++++++++++
>>> spaceman/init.c | 9 +
>>> spaceman/prealloc.c | 1
>>> spaceman/space.h | 12 +-
>>> spaceman/trim.c | 1
>>> 8 files changed, 413 insertions(+), 8 deletions(-)
>>> create mode 100644 spaceman/freesp.c
>>>
>>>
>>> diff --git a/spaceman/Makefile b/spaceman/Makefile
>>> index 08709b3..3b059ca 100644
>>> --- a/spaceman/Makefile
>>> +++ b/spaceman/Makefile
>>> @@ -7,8 +7,12 @@ include $(TOPDIR)/include/builddefs
>>>
>>> LTCOMMAND = xfs_spaceman
>>> HFILES = init.h space.h
>>> -CFILES = init.c \
>>> - ag.c file.c prealloc.c trim.c
>>> +CFILES = ag.c \
>>> + file.c \
>>> + init.c \
>>> + prealloc.c \
>>> + trim.c
>>> +
>>>
>>> LLDLIBS = $(LIBXCMD)
>>> LTDEPENDENCIES = $(LIBXCMD)
>>> @@ -22,6 +26,10 @@ ifeq ($(ENABLE_EDITLINE),yes)
>>> LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
>>> endif
>>>
>>> +ifeq ($(HAVE_GETFSMAP),yes)
>>> +CFILES += freesp.c
>>> +endif
>>> +
>>> default: depend $(LTCOMMAND)
>>>
>>> include $(BUILDRULES)
>>> diff --git a/spaceman/ag.c b/spaceman/ag.c
>>> index 1eb8aa0..0f1c869 100644
>>> --- a/spaceman/ag.c
>>> +++ b/spaceman/ag.c
>>> @@ -21,6 +21,7 @@
>>> #include "command.h"
>>> #include "input.h"
>>> #include "init.h"
>>> +#include "path.h"
>>> #include "space.h"
>>>
>>> #ifndef XFS_IOC_AGCONTROL
>>> diff --git a/spaceman/file.c b/spaceman/file.c
>>> index 9356066..7c5ea0e 100644
>>> --- a/spaceman/file.c
>>> +++ b/spaceman/file.c
>>> @@ -22,6 +22,7 @@
>>> #include "command.h"
>>> #include "input.h"
>>> #include "init.h"
>>> +#include "path.h"
>>> #include "space.h"
>>>
>>> static cmdinfo_t print_cmd;
>>> @@ -69,8 +70,10 @@ openfile(
>>> char *path,
>>> xfs_fsop_geom_t *geom,
>>> int flags,
>>> - mode_t mode)
>>> + mode_t mode,
>>> + struct fs_path *fs_path)
>>> {
>>> + struct fs_path *fsp;
>>> int fd;
>>>
>>> fd = open(path, flags, mode);
>>> @@ -95,6 +98,15 @@ openfile(
>>> close(fd);
>>> return -1;
>>> }
>>> +
>>> + if (fs_path) {
>>> + fsp = fs_table_lookup(path, FS_MOUNT_POINT);
>>> + if (!fsp) {
>>> + fprintf(stderr, _("Unable to find XFS information."));
>>
>> If I got that error I wouldn't know what it meant...
>
> "Unable to find mount information." ?
I think that if the path isn't found in the table, that means it wasn't
populated on startup, which means it's not [on] an XFS filesystem:
fs = fs_table_lookup(argv[optind], FS_MOUNT_POINT);
if (!fs) {
fprintf(stderr, _("%s: %s is not a mounted XFS filesystem\n"),
progname, argv[optind]);
return 1;
}
or
fprintf(stderr, _("file argument, \"%s\", is not in a mounted XFS filesystem\n"),
file->name);
is what other tools do (although quota does:
fprintf(stderr, "%s: unknown mount point %s\n", progname, dir);
or
fprintf(stderr, "%s: cannot find mount point %s\n",)
Anyway: I think the failure means that the path is not [on] an xfs filesystem,
so that's probably the best information to convey.
-Eric
next prev parent reply other threads:[~2017-05-30 18:56 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-07 15:56 [PATCH v7 0/9] xfsprogs 4.12: GETFSMAP support Darrick J. Wong
2017-05-07 15:56 ` [PATCH 1/9] xfs_io: support the new getfsmap ioctl Darrick J. Wong
2017-05-08 21:01 ` Eric Sandeen
2017-05-15 19:18 ` Darrick J. Wong
2017-05-15 19:30 ` Eric Sandeen
2017-05-07 15:56 ` [PATCH 2/9] xfs_repair: replace rmap_compare with libxfs version Darrick J. Wong
2017-05-07 15:56 ` [PATCH 3/9] xfs_spaceman: space management tool Darrick J. Wong
2017-05-27 1:34 ` Eric Sandeen
2017-05-30 17:37 ` Darrick J. Wong
2017-05-30 18:17 ` Eric Sandeen
2017-05-30 18:47 ` Darrick J. Wong
2017-06-02 19:44 ` Darrick J. Wong
2017-05-07 15:56 ` [PATCH 4/9] xfs_spaceman: add FITRIM support Darrick J. Wong
2017-05-27 0:27 ` Eric Sandeen
2017-05-30 18:24 ` Darrick J. Wong
2017-05-07 15:56 ` [PATCH 5/9] xfs_spaceman: add new speculative prealloc control Darrick J. Wong
2017-05-27 1:45 ` Eric Sandeen
2017-05-30 18:34 ` Darrick J. Wong
2017-05-07 15:56 ` [PATCH 6/9] xfs_spaceman: AG state control Darrick J. Wong
2017-05-26 23:06 ` Eric Sandeen
2017-05-30 18:30 ` Darrick J. Wong
2017-05-07 15:57 ` [PATCH 7/9] xfs_spaceman: Free space mapping command Darrick J. Wong
2017-05-27 1:57 ` Eric Sandeen
2017-05-30 18:40 ` Darrick J. Wong
2017-05-30 18:56 ` Eric Sandeen [this message]
2017-05-30 19:19 ` Darrick J. Wong
2017-05-07 15:57 ` [PATCH 8/9] xfs_spaceman: add a man page Darrick J. Wong
2017-05-07 15:57 ` [PATCH 9/9] xfs_spaceman: add group summary mode Darrick J. Wong
2017-05-08 19:47 ` [PATCH 0.9/9] xfs: introduce the XFS_IOC_GETFSMAP ioctl Darrick J. Wong
2017-05-10 14:46 ` Eric Sandeen
2017-05-10 17:03 ` Darrick J. Wong
2017-05-12 22:29 ` Eric Sandeen
2017-05-12 23:05 ` Darrick J. Wong
2017-05-12 23:11 ` Eric Sandeen
2017-05-26 21:20 ` Eric Sandeen
2017-05-26 21:41 ` Darrick J. Wong
2017-05-26 22:12 ` Eric Sandeen
2017-05-30 18:44 ` Darrick J. Wong
2017-05-30 18:47 ` Eric Sandeen
2017-05-30 18:59 ` Eric Sandeen
-- strict thread matches above, loose matches on Subject: below --
2017-03-08 1:14 [PATCH v6 0/9] xfsprogs 4.12: GETFSMAP support Darrick J. Wong
2017-03-08 1:15 ` [PATCH 7/9] xfs_spaceman: Free space mapping command Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d2defe9d-643e-109c-e070-c25c79f5d6fe@sandeen.net \
--to=sandeen@sandeen.net \
--cc=darrick.wong@oracle.com \
--cc=dchinner@redhat.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).