Simplify eli_resize() function.

MFC after:	3 days
This commit is contained in:
Pawel Jakub Dawidek 2011-10-25 07:44:10 +00:00
parent f1a465000f
commit 79e6fcac83

View File

@ -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);