Commit cca37d45 authored by David Howells's avatar David Howells
Browse files

afs: Add a tracepoint to track the lifetime of the afs_volume struct



Add a tracepoint to track the lifetime of the afs_volume struct.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 6dfdf536
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -482,7 +482,7 @@ static void afs_cell_destroy(struct rcu_head *rcu)

	ASSERTCMP(atomic_read(&cell->usage), ==, 0);

	afs_put_volume(cell->net, cell->root_volume);
	afs_put_volume(cell->net, cell->root_volume, afs_volume_trace_put_cell_root);
	afs_put_vlserverlist(cell->net, rcu_access_pointer(cell->vl_servers));
	afs_put_cell(cell->net, cell->alias_of);
	key_put(cell->anonymous_key);
+2 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ struct afs_operation *afs_alloc_operation(struct key *key, struct afs_volume *vo
	}

	op->key		= key;
	op->volume	= afs_get_volume(volume);
	op->volume	= afs_get_volume(volume, afs_volume_trace_get_new_op);
	op->net		= volume->cell->net;
	op->cb_v_break	= volume->cb_v_break;
	op->debug_id	= atomic_inc_return(&afs_operation_debug_counter);
@@ -233,7 +233,7 @@ int afs_put_operation(struct afs_operation *op)
	afs_end_cursor(&op->ac);
	afs_put_cb_interest(op->net, op->cbi);
	afs_put_serverlist(op->net, op->server_list);
	afs_put_volume(op->net, op->volume);
	afs_put_volume(op->net, op->volume, afs_volume_trace_put_put_op);
	kfree(op);
	return ret;
}
+2 −8
Original line number Diff line number Diff line
@@ -1429,17 +1429,11 @@ extern struct afs_vlserver_list *afs_extract_vlserver_list(struct afs_cell *,
/*
 * volume.c
 */
static inline struct afs_volume *afs_get_volume(struct afs_volume *volume)
{
	if (volume)
		atomic_inc(&volume->usage);
	return volume;
}

extern struct afs_volume *afs_create_volume(struct afs_fs_context *);
extern void afs_activate_volume(struct afs_volume *);
extern void afs_deactivate_volume(struct afs_volume *);
extern void afs_put_volume(struct afs_net *, struct afs_volume *);
extern struct afs_volume *afs_get_volume(struct afs_volume *, enum afs_volume_trace);
extern void afs_put_volume(struct afs_net *, struct afs_volume *, enum afs_volume_trace);
extern int afs_check_volume_status(struct afs_volume *, struct afs_operation *);

/*
+6 −4
Original line number Diff line number Diff line
@@ -376,7 +376,8 @@ static int afs_validate_fc(struct fs_context *fc)
		ctx->key = key;

		if (ctx->volume) {
			afs_put_volume(ctx->net, ctx->volume);
			afs_put_volume(ctx->net, ctx->volume,
				       afs_volume_trace_put_validate_fc);
			ctx->volume = NULL;
		}

@@ -507,7 +508,8 @@ static struct afs_super_info *afs_alloc_sbi(struct fs_context *fc)
			as->dyn_root = true;
		} else {
			as->cell = afs_get_cell(ctx->cell);
			as->volume = afs_get_volume(ctx->volume);
			as->volume = afs_get_volume(ctx->volume,
						    afs_volume_trace_get_alloc_sbi);
		}
	}
	return as;
@@ -517,7 +519,7 @@ static void afs_destroy_sbi(struct afs_super_info *as)
{
	if (as) {
		struct afs_net *net = afs_net(as->net_ns);
		afs_put_volume(net, as->volume);
		afs_put_volume(net, as->volume, afs_volume_trace_put_destroy_sbi);
		afs_put_cell(net, as->cell);
		put_net(as->net_ns);
		kfree(as);
@@ -605,7 +607,7 @@ static void afs_free_fc(struct fs_context *fc)
	struct afs_fs_context *ctx = fc->fs_private;

	afs_destroy_sbi(fc->s_fs_info);
	afs_put_volume(ctx->net, ctx->volume);
	afs_put_volume(ctx->net, ctx->volume, afs_volume_trace_put_free_fc);
	afs_put_cell(ctx->net, ctx->cell);
	key_put(ctx->key);
	kfree(ctx);
+5 −4
Original line number Diff line number Diff line
@@ -193,7 +193,8 @@ static int afs_query_for_alias_one(struct afs_cell *cell, struct key *key,
	read_lock(&p->proc_lock);
	if (!list_empty(&p->proc_volumes))
		pvol = afs_get_volume(list_first_entry(&p->proc_volumes,
						       struct afs_volume, proc_link));
						       struct afs_volume, proc_link),
				      afs_volume_trace_get_query_alias);
	read_unlock(&p->proc_lock);
	if (!pvol)
		return 0;
@@ -203,7 +204,7 @@ static int afs_query_for_alias_one(struct afs_cell *cell, struct key *key,
	/* And see if it's in the new cell. */
	volume = afs_sample_volume(cell, key, pvol->name, pvol->name_len);
	if (IS_ERR(volume)) {
		afs_put_volume(cell->net, pvol);
		afs_put_volume(cell->net, pvol, afs_volume_trace_put_query_alias);
		if (PTR_ERR(volume) != -ENOMEDIUM)
			return PTR_ERR(volume);
		/* That volume is not in the new cell, so not an alias */
@@ -221,8 +222,8 @@ static int afs_query_for_alias_one(struct afs_cell *cell, struct key *key,
		rcu_read_unlock();
	}

	afs_put_volume(cell->net, volume);
	afs_put_volume(cell->net, pvol);
	afs_put_volume(cell->net, volume, afs_volume_trace_put_query_alias);
	afs_put_volume(cell->net, pvol, afs_volume_trace_put_query_alias);
	return ret;
}

Loading