diff options
| author | Sage Weil <sage@inktank.com> | 2013-08-15 11:11:45 -0700 | 
|---|---|---|
| committer | Sage Weil <sage@inktank.com> | 2013-08-15 11:11:45 -0700 | 
| commit | ee3e542fec6e69bc9fb668698889a37d93950ddf (patch) | |
| tree | e74ee766a4764769ef1d3d45d266b4dea64101d3 /fs/seq_file.c | |
| parent | fe2a801b50c0bb8039d627e5ae1fec249d10ff39 (diff) | |
| parent | f1d6e17f540af37bb1891480143669ba7636c4cf (diff) | |
Merge remote-tracking branch 'linus/master' into testing
Diffstat (limited to 'fs/seq_file.c')
| -rw-r--r-- | fs/seq_file.c | 54 | 
1 files changed, 54 insertions, 0 deletions
| diff --git a/fs/seq_file.c b/fs/seq_file.c index 774c1eb7f1c9..3135c2525c76 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -921,3 +921,57 @@ struct hlist_node *seq_hlist_next_rcu(void *v,  		return rcu_dereference(node->next);  }  EXPORT_SYMBOL(seq_hlist_next_rcu); + +/** + * seq_hlist_start_precpu - start an iteration of a percpu hlist array + * @head: pointer to percpu array of struct hlist_heads + * @cpu:  pointer to cpu "cursor" + * @pos:  start position of sequence + * + * Called at seq_file->op->start(). + */ +struct hlist_node * +seq_hlist_start_percpu(struct hlist_head __percpu *head, int *cpu, loff_t pos) +{ +	struct hlist_node *node; + +	for_each_possible_cpu(*cpu) { +		hlist_for_each(node, per_cpu_ptr(head, *cpu)) { +			if (pos-- == 0) +				return node; +		} +	} +	return NULL; +} +EXPORT_SYMBOL(seq_hlist_start_percpu); + +/** + * seq_hlist_next_percpu - move to the next position of the percpu hlist array + * @v:    pointer to current hlist_node + * @head: pointer to percpu array of struct hlist_heads + * @cpu:  pointer to cpu "cursor" + * @pos:  start position of sequence + * + * Called at seq_file->op->next(). + */ +struct hlist_node * +seq_hlist_next_percpu(void *v, struct hlist_head __percpu *head, +			int *cpu, loff_t *pos) +{ +	struct hlist_node *node = v; + +	++*pos; + +	if (node->next) +		return node->next; + +	for (*cpu = cpumask_next(*cpu, cpu_possible_mask); *cpu < nr_cpu_ids; +	     *cpu = cpumask_next(*cpu, cpu_possible_mask)) { +		struct hlist_head *bucket = per_cpu_ptr(head, *cpu); + +		if (!hlist_empty(bucket)) +			return bucket->first; +	} +	return NULL; +} +EXPORT_SYMBOL(seq_hlist_next_percpu); | 
