...
Print the pool or container UUID at the start of the message, since there are usually multiple targets running on a single server or multiple mountpoints on a client. The error messages should also include enough information to make some useful diagnosis of the problem (e.g. FID and/or filename, client NID, actual values that caused failures, etc). Otherwise, there is little value in having printed an error, but then needing to reproduce the problem to diagnose it:
right:
D_ERROR(DF_UUID"%s: unsupported incompat filesystem feature(s) %x\n", DP_UUID(po_uuid), incompat); D_ERROR(DF_UUID"%s: cannot create root entry: rc = %d"DF_RC"\n", DP_UUID(co_uuid), DP_RC(rc)); D_ERROR(DF_UUID"%s: error initializing object: rc = %d"DF_RC"\n",DP_UUID(co_uuid), DP_RC(rc));
D_ERROR(DF_UUID"%s: cannot start coordinator thread: rc = %d"DF_RC"\n", mdt_obd_name(mdt), DP_RC(rc));
wrong: D_ERROR("Cannot get handle\n"); D_ERROR("NULL bitmap!\n"); D_ERROR("invalid event\n"); D_ERROR("allocation failed\n");
Error messages that print a numeric error value should print it at the end of the line in a consistent format using ": rc = %d%d\n"
:
right:
D_ERROR("%s: error creating pool %s %s %s: rc = %d",
D_ERROR("%s: cannot destroy container: rc = %d\n", DP_UUID(co_uuid) ,rc);
wrong: D_ERROR("err %d on param %d\n", rc, ptr); D_ERROR("Can't get index (%d)\n", rc);
DAOS specific error messages (e.g. DER_*) should be printed using the DF_RC macro:
right:
D_ERROR(DF_UUID": cannot create root entry: rc = "DF_RC"\n", DP_UUID(co_uuid), DP_RC(rc));
wrong: D_ERROR(DF_UUID": cannot create root entry: rc = %d\n", DP_UUID(co_uuid), rc);