]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_io: don't re-query geometry information in fsmap_f
authorChristoph Hellwig <hch@lst.de>
Fri, 20 Dec 2024 03:49:40 +0000 (19:49 -0800)
committerChristoph Hellwig <hch@lst.de>
Tue, 8 Apr 2025 07:28:23 +0000 (09:28 +0200)
But use the information store in "file".

Signed-off-by: Christoph Hellwig <hch@lst.de>
io/fsmap.c

index 6a87e8972f26c4cd7480e678d2c0ab555139fba9..3cc1b510316c04bf712e95d45e2c9e91eeaf3b91 100644 (file)
@@ -166,9 +166,9 @@ static void
 dump_map_verbose(
        unsigned long long      *nr,
        struct fsmap_head       *head,
-       bool                    *dumped_flags,
-       struct xfs_fsop_geom    *fsgeo)
+       bool                    *dumped_flags)
 {
+       struct xfs_fsop_geom    *fsgeo = &file->geom;
        unsigned long long      i;
        struct fsmap            *p;
        int                     agno;
@@ -395,7 +395,6 @@ fsmap_f(
        struct fsmap            *p;
        struct fsmap_head       *head;
        struct fsmap            *l, *h;
-       struct xfs_fsop_geom    fsgeo;
        long long               start = 0;
        long long               end = -1;
        int                     map_size;
@@ -470,17 +469,6 @@ fsmap_f(
                end <<= BBSHIFT;
        }
 
-       if (vflag) {
-               c = -xfrog_geometry(file->fd, &fsgeo);
-               if (c) {
-                       fprintf(stderr,
-                               _("%s: can't get geometry [\"%s\"]: %s\n"),
-                               progname, file->name, strerror(c));
-                       exitcode = 1;
-                       return 0;
-               }
-       }
-
        map_size = nflag ? nflag : 131072 / sizeof(struct fsmap);
        head = malloc(fsmap_sizeof(map_size));
        if (head == NULL) {
@@ -531,7 +519,7 @@ fsmap_f(
                        break;
 
                if (vflag)
-                       dump_map_verbose(&nr, head, &dumped_flags, &fsgeo);
+                       dump_map_verbose(&nr, head, &dumped_flags);
                else if (mflag)
                        dump_map_machine(&nr, head);
                else