diff options
author | smh <smh@FreeBSD.org> | 2014-09-07 21:30:47 +0000 |
---|---|---|
committer | smh <smh@FreeBSD.org> | 2014-09-07 21:30:47 +0000 |
commit | a7cb473513d1db7492658dd436833db2cbb9707c (patch) | |
tree | e2777dfe3f459602c4f16cff1658391d775a8252 /sys/geom | |
parent | 73701b02923b72b81fa364c935209a6afca9c0f3 (diff) | |
download | FreeBSD-src-a7cb473513d1db7492658dd436833db2cbb9707c.zip FreeBSD-src-a7cb473513d1db7492658dd436833db2cbb9707c.tar.gz |
MFC r256956:
Improve ZFS N-way mirror read performance by using load and locality
information.
MFC r260713:
Fix ZFS mirror code for handling multiple DVA's
Also make the addition of the d_rotation_rate binary compatible. This allows
storage drivers compiled for 10.0 to work by preserving the ABI for disks.
Approved by: re (gjb)
Sponsored by: Multiplay
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom.h | 1 | ||||
-rw-r--r-- | sys/geom/geom_disk.c | 29 | ||||
-rw-r--r-- | sys/geom/geom_disk.h | 7 | ||||
-rw-r--r-- | sys/geom/geom_subr.c | 7 |
4 files changed, 34 insertions, 10 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 1c1fdb03..f313d02 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -274,6 +274,7 @@ int g_handleattr(struct bio *bp, const char *attribute, const void *val, int len); int g_handleattr_int(struct bio *bp, const char *attribute, int val); int g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val); +int g_handleattr_uint16_t(struct bio *bp, const char *attribute, uint16_t val); int g_handleattr_str(struct bio *bp, const char *attribute, const char *str); struct g_consumer * g_new_consumer(struct g_geom *gp); struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...) diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 5be9043..2c6b00b 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -412,23 +412,32 @@ g_disk_start(struct bio *bp) break; else if (g_handleattr_str(bp, "GEOM::ident", dp->d_ident)) break; - else if (g_handleattr(bp, "GEOM::hba_vendor", - &dp->d_hba_vendor, 2)) + else if (g_handleattr_uint16_t(bp, "GEOM::hba_vendor", + dp->d_hba_vendor)) break; - else if (g_handleattr(bp, "GEOM::hba_device", - &dp->d_hba_device, 2)) + else if (g_handleattr_uint16_t(bp, "GEOM::hba_device", + dp->d_hba_device)) break; - else if (g_handleattr(bp, "GEOM::hba_subvendor", - &dp->d_hba_subvendor, 2)) + else if (g_handleattr_uint16_t(bp, "GEOM::hba_subvendor", + dp->d_hba_subvendor)) break; - else if (g_handleattr(bp, "GEOM::hba_subdevice", - &dp->d_hba_subdevice, 2)) + else if (g_handleattr_uint16_t(bp, "GEOM::hba_subdevice", + dp->d_hba_subdevice)) break; else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump")) g_disk_kerneldump(bp, dp); else if (!strcmp(bp->bio_attribute, "GEOM::setstate")) g_disk_setstate(bp, sc); - else + else if (!strcmp(bp->bio_attribute, "GEOM::rotation_rate")) { + uint64_t v; + + if ((dp->d_flags & DISKFLAG_LACKS_ROTRATE) == 0) + v = dp->d_rotation_rate; + else + v = 0; /* rate unknown */ + g_handleattr_uint16_t(bp, "GEOM::rotation_rate", v); + break; + } else error = ENOIOCTL; break; case BIO_FLUSH: @@ -694,6 +703,8 @@ disk_create(struct disk *dp, int version) dp->d_name, dp->d_unit); return; } + if (version < DISK_VERSION_04) + dp->d_flags |= DISKFLAG_LACKS_ROTRATE; KASSERT(dp->d_strategy != NULL, ("disk_create need d_strategy")); KASSERT(dp->d_name != NULL, ("disk_create need d_name")); KASSERT(*dp->d_name != 0, ("disk_create need d_name")); diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h index b092146..09194c0 100644 --- a/sys/geom/geom_disk.h +++ b/sys/geom/geom_disk.h @@ -100,6 +100,9 @@ struct disk { /* Fields private to the driver */ void *d_drv1; + + /* New field - don't use if DISKFLAG_LACKS_ROTRATE is set */ + uint16_t d_rotation_rate; }; #define DISKFLAG_NEEDSGIANT 0x1 @@ -108,6 +111,7 @@ struct disk { #define DISKFLAG_CANFLUSHCACHE 0x8 #define DISKFLAG_UNMAPPED_BIO 0x10 #define DISKFLAG_DIRECT_COMPLETION 0x20 +#define DISKFLAG_LACKS_ROTRATE 0x40 struct disk *disk_alloc(void); void disk_create(struct disk *disk, int version); @@ -122,7 +126,8 @@ int disk_resize(struct disk *dp, int flag); #define DISK_VERSION_01 0x5856105a #define DISK_VERSION_02 0x5856105b #define DISK_VERSION_03 0x5856105c -#define DISK_VERSION DISK_VERSION_03 +#define DISK_VERSION_04 0x5856105d +#define DISK_VERSION DISK_VERSION_04 #endif /* _KERNEL */ #endif /* _GEOM_GEOM_DISK_H_ */ diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index 7d2c459..f42aae5 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -952,6 +952,13 @@ g_handleattr_int(struct bio *bp, const char *attribute, int val) } int +g_handleattr_uint16_t(struct bio *bp, const char *attribute, uint16_t val) +{ + + return (g_handleattr(bp, attribute, &val, sizeof val)); +} + +int g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val) { |