lkml.org 
[lkml]   [2012]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 1/3]block: seperate CFQ io context management code
Hi,

Two of nitpicks below ..


2012-01-04 3:53 PM, Shaohua Li Wrote:
> CFQ's io context management creates a per-device io context for each task.
> It's quite generic. Separate it from CFQ, and use it for fiops I/O scheduler.
>
> Signed-off-by: Shaohua Li<shaohua.li@intel.com>
> ---

[snip]

> +int ioc_builder_init(struct ioc_builder *builder)
> +{
> + if (!builder->alloc_ioc || !builder->free_ioc)
> + return -ENOMEM;
> +
> + builder->ioc_count = alloc_percpu(unsigned long);
> + if (!builder->ioc_count)
> + return -ENOMEM;
> +
> + builder->ioc_gone = NULL;
> + spin_lock_init(&builder->ioc_gone_lock);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(ioc_builder_init);
> +
> +void io_context_builder_exit(struct ioc_builder *builder)

It'd be better using 'ioc_builder_exit' as a name for consistency, IMHO.


> +{
> + DECLARE_COMPLETION_ONSTACK(all_gone);
> +
> + builder->ioc_gone =&all_gone;
> + /* ioc_gone's update must be visible before reading ioc_count */
> + smp_wmb();
> +
> + /*
> + * this also protects us from entering cfq_slab_kill() with
> + * pending RCU callbacks
> + */
> + if (elv_ioc_count_read(*builder->ioc_count))
> + wait_for_completion(&all_gone);
> +
> + free_percpu(builder->ioc_count);
> +}
> +EXPORT_SYMBOL(io_context_builder_exit);

[snip]

> +static void queue_data_cic_free_rcu(struct rcu_head *head)
> +{
> + struct dev_io_context *cic;
> + struct ioc_builder *builder;
> +
> + cic = container_of(head, struct dev_io_context, rcu_head);
> + builder = cic->builder;
> +
> + builder->free_ioc(builder, cic);
> + elv_ioc_count_dec(*builder->ioc_count);
> +
> + if (builder->ioc_gone) {
> + /*
> + * CFQ scheduler is exiting, grab exit lock and check

s/CFQ/IO/ ?

Thanks.
Namhyung Kim


\
 
 \ /
  Last update: 2012-01-04 09:33    [W:1.227 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site