Re: [RFC PATCH v2] Add new elevator ops for request hint

Shaohua Li
2011-08-11T01:10:49Z

2011/8/11 Kyungmin Park <kmpark@infradead.org>:
> Hi Jens
>
> Now eMMC device requires the upper layer information to improve the data
> performance and reliability.
>
> . Context ID
> Using the context information, it can sort out the data internally and improve the performance.
> The main problem is that it's needed to define "What's the context".
> Actually I expect cfq queue has own unique ID but it doesn't so decide to use the pid instead
>
> . Data Tag
> Using the Data Tag (1-bit information), It writes the data at SLC area when it's hot data. So it can make the chip more reliable.
> First I expect the REQ_META but current ext4 doesn't pass the WRITE_META. only use the READ_META. so it needs to investigate it.
>
> With these characteristics, it's helpful to teach the device. After some consideration. it's needed to pass out these information at request data structure.
>
> Sample usage is following in drivers/mmc/card/block.c
>
>        struct elevator_queue *e = md->queue.queue->elevator;
>        struct request_hint hint;
>        int ret;
>
>        if (e->ops->elevator_get_req_hint_fn && req)
>                ret = e->ops->elevator_get_req_hint_fn(req, &hint);
please put this to blkdev.h or similar. directly using it here
is abnormal.

> Thank you,
> Kyungmin Park
> ---
> Changelog v2
> - Don't add the request member. instead add new elevator ops
>
> ---
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index 1f96ad6..5089f67 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -3800,6 +3800,18 @@ queue_fail:
>        return 1;
>  }
>
> +static int cfq_get_request_hint(struct request *rq, struct request_hint *hint)
> +{
> +       struct cfq_queue *cfqq = RQ_CFQQ(rq);
> +
> +       if (cfqq) {
> +               hint->context = cfqq->pid;
> +               hint->hot = !!(rq->cmd_flags & REQ_META);
> +       }
if the rq is in cfq, the cfqq is always valid, so don't need the check.

Thanks,
Shaohua