@@ -9394,7 +9394,7 @@ zdb_print_anyraid_tile_layout(vdev_t *vd)
9394
9394
// Create and populate table with all the values we need to print.
9395
9395
char * * * table = malloc (sizeof (* table ) * cols );
9396
9396
for (int i = 0 ; i < cols ; i ++ ) {
9397
- table [i ] = calloc (var -> vd_children [i ]-> van_capacity ,
9397
+ table [i ] = calloc (var -> vd_children [i ]-> van_capacity + 1 ,
9398
9398
sizeof (* * table ));
9399
9399
}
9400
9400
@@ -9440,7 +9440,7 @@ zdb_print_anyraid_tile_layout(vdev_t *vd)
9440
9440
for (int v = 0 ; v < cols ; v ++ ) {
9441
9441
if (final [v ]) {
9442
9442
ASSERT3U (i , >=,
9443
- var -> vd_children [v ]-> van_capacity );
9443
+ var -> vd_children [v ]-> van_capacity + 1 );
9444
9444
int extra_width = 0 ;
9445
9445
if (v == 0 || !printed [v - 1 ])
9446
9446
extra_width ++ ;
@@ -9449,7 +9449,7 @@ zdb_print_anyraid_tile_layout(vdev_t *vd)
9449
9449
printed [v ] = B_FALSE ;
9450
9450
continue ;
9451
9451
}
9452
- if (i + 1 == var -> vd_children [v ]-> van_capacity )
9452
+ if (i + 1 == var -> vd_children [v ]-> van_capacity + 1 )
9453
9453
final [v ] = B_TRUE ;
9454
9454
if (v - 1 != last_printed )
9455
9455
(void ) printf ("│" );
@@ -9466,7 +9466,7 @@ zdb_print_anyraid_tile_layout(vdev_t *vd)
9466
9466
}
9467
9467
(void ) printf ("\n" );
9468
9468
for (int i = 0 ; i < cols ; i ++ ) {
9469
- for (int j = 0 ; j < var -> vd_children [i ]-> van_capacity ; j ++ )
9469
+ for (int j = 0 ; j < var -> vd_children [i ]-> van_capacity + 1 ; j ++ )
9470
9470
if (table [i ][j ])
9471
9471
free (table [i ][j ]);
9472
9472
free (table [i ]);
@@ -9539,7 +9539,7 @@ print_anyraid_mapping(vdev_t *vd, int child, int mapping,
9539
9539
& disk_id ) != 0 )
9540
9540
(void ) printf ("No valid disk ID\n" );
9541
9541
9542
- (void ) printf ("version: %6d\ttile size: %8lx\ttxg: %lu\n" ,
9542
+ (void ) printf ("version: %6d\ttile size: %# 8lx\ttxg: %lu\n" ,
9543
9543
version , tile_size , written_txg );
9544
9544
(void ) printf ("map length: %6u\tdisk id: %3u\n" , map_length , disk_id );
9545
9545
@@ -9722,12 +9722,18 @@ zdb_dump_anyraid_map_vdev(vdev_t *vd, int verbosity)
9722
9722
ASSERT3P (vd -> vdev_ops , = = , & vdev_anyraid_ops );
9723
9723
vdev_anyraid_t * var = vd -> vdev_tsd ;
9724
9724
9725
- (void ) printf ("\t%-5s%11llu %s %16llx\n" ,
9725
+ (void ) printf ("\t%-5s%11llu %s %# 16llx\n" ,
9726
9726
"vdev" , (u_longlong_t )vd -> vdev_id ,
9727
9727
"tile_size" , (u_longlong_t )var -> vd_tile_size );
9728
- (void ) printf ("\t%-8s%8llu %-12s %10u\n" , "tiles" ,
9729
- (u_longlong_t )avl_numnodes (& var -> vd_tile_map ),
9730
- "checkpoint tile" , var -> vd_checkpoint_tile );
9728
+ (void ) printf ("\t%-8s%8llu" , "tiles" ,
9729
+ (u_longlong_t )avl_numnodes (& var -> vd_tile_map ));
9730
+ if (var -> vd_checkpoint_tile != UINT32_MAX ) {
9731
+ (void ) printf (". %-12s %10u\n" , "checkpoint tile" ,
9732
+ var -> vd_checkpoint_tile );
9733
+ } else {
9734
+ (void ) printf ("\n" );
9735
+ }
9736
+
9731
9737
(void ) printf ("\t%16s %12s %13s\n" , "----------------" ,
9732
9738
"------------" , "-------------" );
9733
9739
@@ -9759,23 +9765,26 @@ zdb_dump_anyraid_map(char *vdev_str, spa_t *spa, int verbosity)
9759
9765
{
9760
9766
vdev_t * rvd , * vd ;
9761
9767
9762
- (void ) printf ("\nAnyRAID tiles:\n" );
9763
-
9764
9768
/* A specific vdev. */
9765
9769
if (vdev_str != NULL ) {
9766
9770
vd = zdb_vdev_lookup (spa -> spa_root_vdev , vdev_str );
9767
9771
if (vd == NULL ) {
9768
9772
(void ) printf ("Invalid vdev: %s\n" , vdev_str );
9769
9773
return (EINVAL );
9770
9774
}
9771
- if (vd -> vdev_ops != & vdev_anyraid_ops ) {
9775
+ if (vd -> vdev_ops != & vdev_anyraid_ops &&
9776
+ (vd -> vdev_parent == NULL ||
9777
+ (vd = vd -> vdev_parent )-> vdev_ops != & vdev_anyraid_ops )) {
9772
9778
(void ) printf ("Not an anyraid vdev: %s\n" , vdev_str );
9773
9779
return (EINVAL );
9774
9780
}
9781
+
9782
+ (void ) printf ("\nAnyRAID tiles:\n" );
9775
9783
zdb_dump_anyraid_map_vdev (vd , verbosity );
9776
9784
return (0 );
9777
9785
}
9778
9786
9787
+ (void ) printf ("\nAnyRAID tiles:\n" );
9779
9788
/* All anyraid vdevs. */
9780
9789
rvd = spa -> spa_root_vdev ;
9781
9790
for (uint64_t c = 0 ; c < rvd -> vdev_children ; c ++ ) {
0 commit comments