Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved zpool status output, list all the dataset affected by errlog. #9175

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion include/sys/spa.h
Expand Up @@ -1175,11 +1175,14 @@ extern void zfs_post_remove(spa_t *spa, vdev_t *vd);
extern void zfs_post_state_change(spa_t *spa, vdev_t *vd, uint64_t laststate);
extern void zfs_post_autoreplace(spa_t *spa, vdev_t *vd);
extern uint64_t spa_get_errlog_size(spa_t *spa);
extern int spa_get_errlog(spa_t *spa, void *uaddr, size_t *count);
extern int spa_get_errlog(spa_t *spa, void *uaddr, uint64_t *count);
extern void spa_errlog_rotate(spa_t *spa);
extern void spa_errlog_drain(spa_t *spa);
extern void spa_errlog_sync(spa_t *spa, uint64_t txg);
extern void spa_get_errlists(spa_t *spa, avl_tree_t *last, avl_tree_t *scrub);
extern void spa_delete_dataset_errlog(spa_t *spa, uint64_t ds, dmu_tx_t *tx);
extern void spa_swap_errlog(spa_t *spa, uint64_t new_head_ds,
uint64_t old_head_ds, dmu_tx_t *tx);

/* vdev cache */
extern void vdev_cache_stat_init(void);
Expand Down
7 changes: 7 additions & 0 deletions include/sys/zio.h
Expand Up @@ -305,6 +305,13 @@ struct zbookmark_phys {
uint64_t zb_blkid;
};

typedef struct zbookmark_err_phys {
uint64_t zb_object;
int64_t zb_level;
uint64_t zb_blkid;
uint64_t zb_birth;
} zbookmark_err_phys_t;

#define SET_BOOKMARK(zb, objset, object, level, blkid) \
{ \
(zb)->zb_objset = objset; \
Expand Down
1 change: 1 addition & 0 deletions include/zfeature_common.h
Expand Up @@ -72,6 +72,7 @@ typedef enum spa_feature {
SPA_FEATURE_BOOKMARK_WRITTEN,
SPA_FEATURE_LOG_SPACEMAP,
SPA_FEATURE_LIVELIST,
SPA_FEATURE_HEAD_ERRLOG,
SPA_FEATURES
} spa_feature_t;

Expand Down
22 changes: 22 additions & 0 deletions man/man5/zpool-features.5
Expand Up @@ -925,5 +925,27 @@ is used to checkpoint the pool.
The feature will only return back to being \fBenabled\fR when the pool
is rewound or the checkpoint has been discarded.


.sp
.ne 2
.na
\fBhead_errlog\fR
.ad
.RS 4n
.TS
l l .
GUID com.delphix:head_errlog
READ\-ONLY COMPATIBLE no
DEPENDENCIES none
.TE

This feature enables the upgraded version of errlog. This required on disk
error format change. Now, errorlog of each head dataset is stored
seprately in zap object and primarily keyed by this head Id.
By this feature every dataset affected by an error block is listed under
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this sounds better as:
"With this feature enabled, every dataset affected by an error block is listed in the output of
\fBzpool status\fR.

\fBzpool status\fR command.

The feature can only be set at the time of pool creation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature can only be enabled at pool creation time.


.SH "SEE ALSO"
zpool(8)
7 changes: 7 additions & 0 deletions module/zcommon/zfeature_common.c
Expand Up @@ -553,6 +553,13 @@ zpool_feature_init(void)
"com.datto:resilver_defer", "resilver_defer",
"Support for defering new resilvers when one is already running.",
ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL);

{
zfeature_register(SPA_FEATURE_HEAD_ERRLOG,
"com.delphix:head_errlog", "head_errlog",
"Improved zpool status command output.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature is actually the logging of the errors to the ZAP, so maybe:
"Introduce an on-disk block error log"

ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, ZFEATURE_TYPE_BOOLEAN, NULL);
}
}

#if defined(_KERNEL)
Expand Down
9 changes: 9 additions & 0 deletions module/zfs/dsl_dataset.c
Expand Up @@ -3726,6 +3726,15 @@ dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx)

dsl_dir_rele(odd, FTAG);
promote_rele(ddpa, FTAG);

/*
* Transfer common error blocks from old head to new head.
*/
if (spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_HEAD_ERRLOG)) {
uint64_t old_head = origin_head->ds_object;
uint64_t new_head = hds->ds_object;
spa_swap_errlog(dp->dp_spa, new_head, old_head, tx);
}
}

/*
Expand Down
3 changes: 3 additions & 0 deletions module/zfs/dsl_destroy.c
Expand Up @@ -1139,6 +1139,9 @@ dsl_destroy_head_sync_impl(dsl_dataset_t *ds, dmu_tx_t *tx)
dsl_destroy_snapshot_sync_impl(prev, B_FALSE, tx);
dsl_dataset_rele(prev, FTAG);
}
/* Delete errlog. */
if (spa_feature_is_enabled(dp->dp_spa, SPA_FEATURE_HEAD_ERRLOG))
spa_delete_dataset_errlog(dp->dp_spa, ds->ds_object, tx);
}

void
Expand Down