Skip to content

Commit 5baffbe

Browse files
author
Paul Dagnelie
committed
Implement allocation size ranges and use for gang leaves
Signed-off-by: Paul Dagnelie <paul.dagnelie@klarasystems.com>
1 parent a44f423 commit 5baffbe

File tree

14 files changed

+422
-70
lines changed

14 files changed

+422
-70
lines changed

cmd/zdb/zdb.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -2542,12 +2542,14 @@ snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp,
25422542

25432543
blkbuf[0] = '\0';
25442544

2545-
for (i = 0; i < ndvas; i++)
2545+
for (i = 0; i < ndvas; i++) {
25462546
(void) snprintf(blkbuf + strlen(blkbuf),
2547-
buflen - strlen(blkbuf), "%llu:%llx:%llx ",
2547+
buflen - strlen(blkbuf), "%llu:%llx:%llx%s ",
25482548
(u_longlong_t)DVA_GET_VDEV(&dva[i]),
25492549
(u_longlong_t)DVA_GET_OFFSET(&dva[i]),
2550-
(u_longlong_t)DVA_GET_ASIZE(&dva[i]));
2550+
(u_longlong_t)DVA_GET_ASIZE(&dva[i]),
2551+
(DVA_GET_GANG(&dva[i]) ? "G" : ""));
2552+
}
25512553

25522554
if (BP_IS_HOLE(bp)) {
25532555
(void) snprintf(blkbuf + strlen(blkbuf),
@@ -8978,7 +8980,7 @@ zdb_read_block(char *thing, spa_t *spa)
89788980

89798981
DVA_SET_VDEV(&dva[0], vd->vdev_id);
89808982
DVA_SET_OFFSET(&dva[0], offset);
8981-
DVA_SET_GANG(&dva[0], !!(flags & ZDB_FLAG_GBH));
8983+
DVA_SET_GANG(&dva[0], 0);
89828984
DVA_SET_ASIZE(&dva[0], vdev_psize_to_asize(vd, psize));
89838985

89848986
BP_SET_BIRTH(bp, TXG_INITIAL, TXG_INITIAL);
@@ -8993,7 +8995,7 @@ zdb_read_block(char *thing, spa_t *spa)
89938995
BP_SET_BYTEORDER(bp, ZFS_HOST_BYTEORDER);
89948996

89958997
spa_config_enter(spa, SCL_STATE, FTAG, RW_READER);
8996-
zio = zio_root(spa, NULL, NULL, 0);
8998+
zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL);
89978999

89989000
if (vd == vd->vdev_top) {
89999001
/*

include/sys/metaslab.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extern "C" {
4040

4141
typedef struct metaslab_ops {
4242
const char *msop_name;
43-
uint64_t (*msop_alloc)(metaslab_t *, uint64_t);
43+
uint64_t (*msop_alloc)(metaslab_t *, uint64_t, uint64_t, uint64_t *);
4444
} metaslab_ops_t;
4545

4646

@@ -85,7 +85,10 @@ uint64_t metaslab_largest_allocatable(metaslab_t *);
8585

8686
int metaslab_alloc(spa_t *, metaslab_class_t *, uint64_t,
8787
blkptr_t *, int, uint64_t, blkptr_t *, int, zio_alloc_list_t *, zio_t *,
88-
int);
88+
int);
89+
int metaslab_alloc_range(spa_t *, metaslab_class_t *, uint64_t, uint64_t,
90+
blkptr_t *, int, uint64_t, blkptr_t *, int, zio_alloc_list_t *, zio_t *,
91+
int);
8992
int metaslab_alloc_dva(spa_t *, metaslab_class_t *, uint64_t,
9093
dva_t *, int, dva_t *, uint64_t, int, zio_alloc_list_t *, int);
9194
void metaslab_free(spa_t *, const blkptr_t *, uint64_t, boolean_t);
@@ -99,6 +102,7 @@ void metaslab_check_free(spa_t *, const blkptr_t *);
99102

100103
void metaslab_stat_init(void);
101104
void metaslab_stat_fini(void);
105+
void metaslab_trace_move(zio_alloc_list_t *, zio_alloc_list_t *);
102106
void metaslab_trace_init(zio_alloc_list_t *);
103107
void metaslab_trace_fini(zio_alloc_list_t *);
104108

@@ -129,6 +133,8 @@ uint64_t metaslab_group_get_space(metaslab_group_t *);
129133
void metaslab_group_histogram_verify(metaslab_group_t *);
130134
uint64_t metaslab_group_fragmentation(metaslab_group_t *);
131135
void metaslab_group_histogram_remove(metaslab_group_t *, metaslab_t *);
136+
void metaslab_group_alloc_increment_all(spa_t *, blkptr_t *, const void *,
137+
int, int);
132138
void metaslab_group_alloc_decrement(spa_t *, uint64_t, const void *, int, int,
133139
boolean_t);
134140
void metaslab_group_alloc_verify(spa_t *, const blkptr_t *, const void *, int);

include/sys/zio.h

+1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ typedef uint64_t zio_flag_t;
226226
#define ZIO_FLAG_REEXECUTED (1ULL << 30)
227227
#define ZIO_FLAG_DELEGATED (1ULL << 31)
228228
#define ZIO_FLAG_DIO_CHKSUM_ERR (1ULL << 32)
229+
#define ZIO_FLAG_PREALLOCATED (1ULL << 33)
229230

230231
#define ZIO_ALLOCATOR_NONE (-1)
231232
#define ZIO_HAS_ALLOCATOR(zio) ((zio)->io_allocator != ZIO_ALLOCATOR_NONE)

0 commit comments

Comments
 (0)