Go through with write_metadata() non-error-handling and make it return "void".

This is mostly to avoid dead variable assignment warning by LLVM.
No functional change.

Pointed out by:	trasz
Approved by:	gnn (mentor)
This commit is contained in:
Ivan Voras 2010-01-25 20:51:40 +00:00
parent 654baa4adf
commit 49e232f2c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202987

View File

@ -98,7 +98,7 @@ SYSCTL_UINT(_kern_geom_virstor, OID_AUTO, component_watermark, CTLFLAG_RW,
"Minimum number of free components before issuing administrative warning");
static int read_metadata(struct g_consumer *, struct g_virstor_metadata *);
static int write_metadata(struct g_consumer *, struct g_virstor_metadata *);
static void write_metadata(struct g_consumer *, struct g_virstor_metadata *);
static int clear_metadata(struct g_virstor_component *);
static int add_provider_to_geom(struct g_virstor_softc *, struct g_provider *,
struct g_virstor_metadata *);
@ -1002,8 +1002,13 @@ read_metadata(struct g_consumer *cp, struct g_virstor_metadata *md)
/**
* Utility function: encode & write metadata. Assumes topology lock is
* held.
*
* There is no useful way of recovering from errors in this function,
* not involving panicking the kernel. If the metadata cannot be written
* the most we can do is notify the operator and hope he spots it and
* replaces the broken drive.
*/
static int
static void
write_metadata(struct g_consumer *cp, struct g_virstor_metadata *md)
{
struct g_provider *pp;
@ -1015,8 +1020,11 @@ write_metadata(struct g_consumer *cp, struct g_virstor_metadata *md)
LOG_MSG(LVL_DEBUG, "Writing metadata on %s", cp->provider->name);
g_topology_assert();
error = g_access(cp, 0, 1, 0);
if (error != 0)
return (error);
if (error != 0) {
LOG_MSG(LVL_ERROR, "g_access(0,1,0) failed for %s: %d",
cp->provider->name, error);
return;
}
pp = cp->provider;
buf = malloc(pp->sectorsize, M_GVIRSTOR, M_WAITOK);
@ -1026,9 +1034,11 @@ write_metadata(struct g_consumer *cp, struct g_virstor_metadata *md)
pp->sectorsize);
g_topology_lock();
g_access(cp, 0, -1, 0);
free(buf, M_GVIRSTOR);
return (0);
if (error != 0)
LOG_MSG(LVL_ERROR, "Error %d writing metadata to %s",
error, cp->provider->name);
}
/*