diff options
author | pjd <pjd@FreeBSD.org> | 2011-10-25 07:44:10 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2011-10-25 07:44:10 +0000 |
commit | a2d6adcac80a4ed14ee839e02bb92bc13efaf51d (patch) | |
tree | 5381f47afef7011674dc059913df349a61ed31a1 /sbin | |
parent | aa3a4f205db17e19a66aa0a9490d636f161497b2 (diff) | |
download | FreeBSD-src-a2d6adcac80a4ed14ee839e02bb92bc13efaf51d.zip FreeBSD-src-a2d6adcac80a4ed14ee839e02bb92bc13efaf51d.tar.gz |
Simplify eli_resize() function.
MFC after: 3 days
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/geom/class/eli/geom_eli.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sbin/geom/class/eli/geom_eli.c b/sbin/geom/class/eli/geom_eli.c index 11c8ce0..ca0c80b 100644 --- a/sbin/geom/class/eli/geom_eli.c +++ b/sbin/geom/class/eli/geom_eli.c @@ -1480,18 +1480,12 @@ eli_resize(struct gctl_req *req) * it back to the correct place on the provider. */ md.md_provsize = mediasize; - eli_metadata_encode(&md, sector); - if (pwrite(provfd, sector, secsize, mediasize - secsize) != secsize) { - gctl_error(req, "Cannot write metadata: %s.", strerror(errno)); - goto out; - } - (void)g_flush(provfd); - + /* Write metadata to the provider. */ + (void)eli_metadata_store(req, prov, &md); /* Now trash the old metadata. */ - if (eli_trash_metadata(req, prov, provfd, oldsize - secsize) == -1) - goto out; + (void)eli_trash_metadata(req, prov, provfd, oldsize - secsize); out: - if (provfd >= 0) + if (provfd != -1) (void)g_close(provfd); if (sector != NULL) { bzero(sector, secsize); |