svn commit: r327070 - stable/11/sys/geom/mirror
Mark Johnston
markj at FreeBSD.org
Thu Dec 21 22:47:05 UTC 2017
Author: markj
Date: Thu Dec 21 22:47:04 2017
New Revision: 327070
URL: https://svnweb.freebsd.org/changeset/base/327070
Log:
MFC r326409:
Update gmirror metadata less frequently when synchronizing.
Modified:
stable/11/sys/geom/mirror/g_mirror.c
stable/11/sys/geom/mirror/g_mirror.h
Modified: stable/11/sys/geom/mirror/g_mirror.c
==============================================================================
--- stable/11/sys/geom/mirror/g_mirror.c Thu Dec 21 21:24:52 2017 (r327069)
+++ stable/11/sys/geom/mirror/g_mirror.c Thu Dec 21 22:47:04 2017 (r327070)
@@ -69,6 +69,10 @@ SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, disconnect_on
static u_int g_mirror_syncreqs = 2;
SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, sync_requests, CTLFLAG_RDTUN,
&g_mirror_syncreqs, 0, "Parallel synchronization I/O requests.");
+static u_int g_mirror_sync_period = 5;
+SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, sync_update_period, CTLFLAG_RWTUN,
+ &g_mirror_sync_period, 0,
+ "Metadata update period during synchroniztion, in seconds");
#define MSLEEP(ident, mtx, priority, wmesg, timeout) do { \
G_MIRROR_DEBUG(4, "%s: Sleeping %p.", __func__, (ident)); \
@@ -463,6 +467,7 @@ g_mirror_init_disk(struct g_mirror_softc *sc, struct g
disk->d_sync.ds_consumer = NULL;
disk->d_sync.ds_offset = md->md_sync_offset;
disk->d_sync.ds_offset_done = md->md_sync_offset;
+ disk->d_sync.ds_update_ts = time_uptime;
disk->d_genid = md->md_genid;
disk->d_sync.ds_syncid = md->md_syncid;
if (errorp != NULL)
@@ -1457,10 +1462,11 @@ g_mirror_sync_request(struct bio *bp)
if (bp != NULL && bp->bio_offset < offset)
offset = bp->bio_offset;
}
- if (sync->ds_offset_done + (MAXPHYS * 100) < offset) {
- /* Update offset_done on every 100 blocks. */
+ if (g_mirror_sync_period > 0 &&
+ time_uptime - sync->ds_update_ts > g_mirror_sync_period) {
sync->ds_offset_done = offset;
g_mirror_update_metadata(disk);
+ sync->ds_update_ts = time_uptime;
}
return;
}
Modified: stable/11/sys/geom/mirror/g_mirror.h
==============================================================================
--- stable/11/sys/geom/mirror/g_mirror.h Thu Dec 21 21:24:52 2017 (r327069)
+++ stable/11/sys/geom/mirror/g_mirror.h Thu Dec 21 22:47:04 2017 (r327070)
@@ -108,6 +108,7 @@ struct g_mirror_disk_sync {
off_t ds_offset; /* Offset of next request to send. */
off_t ds_offset_done; /* Offset of already synchronized
region. */
+ time_t ds_update_ts; /* Time of last metadata update. */
u_int ds_syncid; /* Disk's synchronization ID. */
u_int ds_inflight; /* Number of in-flight sync requests. */
struct bio **ds_bios; /* BIOs for synchronization I/O. */
More information about the svn-src-stable
mailing list