Date: Mon, 25 Jan 2010 20:51:40 +0000 (UTC) From: Ivan Voras <ivoras@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r202987 - head/sys/geom/virstor Message-ID: <201001252051.o0PKpeFC074786@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ivoras Date: Mon Jan 25 20:51:40 2010 New Revision: 202987 URL: http://svn.freebsd.org/changeset/base/202987 Log: 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) Modified: head/sys/geom/virstor/g_virstor.c Modified: head/sys/geom/virstor/g_virstor.c ============================================================================== --- head/sys/geom/virstor/g_virstor.c Mon Jan 25 19:36:48 2010 (r202986) +++ head/sys/geom/virstor/g_virstor.c Mon Jan 25 20:51:40 2010 (r202987) @@ -98,7 +98,7 @@ SYSCTL_UINT(_kern_geom_virstor, OID_AUTO "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, str /** * 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, st 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, st 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); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001252051.o0PKpeFC074786>