/* If @ub is NULL, dump the lockstate to the console.  */
static int gfs2_dump_lockstate(struct gfs2_sbd *sdp)
/* If @ub is NULL, dump the lockstate to the console.  */
static int gfs2_dump_lockstate(struct gfs2_sbd *sdp)
{
	struct gfs2_glock *gl;
	struct hlist_node *h;
	unsigned int x;
	int error = 0;
	for (x = 0; x < GFS2_GL_HASH_SIZE; x++) {
		read_lock(gl_lock_addr(x));
		hlist_for_each_entry(gl, h, &gl_hash_table[x].hb_list, gl_list) {
			if (gl->gl_sbd != sdp)
				continue;
			error = dump_glock(NULL, gl);
			if (error)
				break;
		}
		read_unlock(gl_lock_addr(x));
		if (error)
			break;
	}
	return error;
}