Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
where is your noop now?
Browse files Browse the repository at this point in the history
  • Loading branch information
fusion2004 committed Nov 29, 2011
1 parent 35a44d2 commit e4594b7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added lab2/.DS_Store
Binary file not shown.
Binary file added lab2/lab2_mark_oleson_and_alexis_jefferson.zip
Binary file not shown.
64 changes: 32 additions & 32 deletions lab4/clook-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
#include <linux/slab.h>
#include <linux/init.h>

struct noop_data {
struct clook_data {
struct list_head queue;
};

static void noop_merged_requests(struct request_queue *q, struct request *rq,
static void clook_merged_requests(struct request_queue *q, struct request *rq,
struct request *next)
{
list_del_init(&next->queuelist);
}

static int noop_dispatch(struct request_queue *q, int force)
static int clook_dispatch(struct request_queue *q, int force)
{
struct noop_data *nd = q->elevator->elevator_data;
struct clook_data *nd = q->elevator->elevator_data;

if (!list_empty(&nd->queue)) {
struct request *rq;
Expand All @@ -32,43 +32,43 @@ static int noop_dispatch(struct request_queue *q, int force)
return 0;
}

static void noop_add_request(struct request_queue *q, struct request *rq)
static void clook_add_request(struct request_queue *q, struct request *rq)
{
struct noop_data *nd = q->elevator->elevator_data;
struct clook_data *nd = q->elevator->elevator_data;

list_add_tail(&rq->queuelist, &nd->queue);
}

static int noop_queue_empty(struct request_queue *q)
static int clook_queue_empty(struct request_queue *q)
{
struct noop_data *nd = q->elevator->elevator_data;
struct clook_data *nd = q->elevator->elevator_data;

return list_empty(&nd->queue);
}

static struct request *
noop_former_request(struct request_queue *q, struct request *rq)
clook_former_request(struct request_queue *q, struct request *rq)
{
struct noop_data *nd = q->elevator->elevator_data;
struct clook_data *nd = q->elevator->elevator_data;

if (rq->queuelist.prev == &nd->queue)
return NULL;
return list_entry(rq->queuelist.prev, struct request, queuelist);
}

static struct request *
noop_latter_request(struct request_queue *q, struct request *rq)
clook_latter_request(struct request_queue *q, struct request *rq)
{
struct noop_data *nd = q->elevator->elevator_data;
struct clook_data *nd = q->elevator->elevator_data;

if (rq->queuelist.next == &nd->queue)
return NULL;
return list_entry(rq->queuelist.next, struct request, queuelist);
}

static void *noop_init_queue(struct request_queue *q)
static void *clook_init_queue(struct request_queue *q)
{
struct noop_data *nd;
struct clook_data *nd;

nd = kmalloc_node(sizeof(*nd), GFP_KERNEL, q->node);
if (!nd)
Expand All @@ -77,43 +77,43 @@ static void *noop_init_queue(struct request_queue *q)
return nd;
}

static void noop_exit_queue(struct elevator_queue *e)
static void clook_exit_queue(struct elevator_queue *e)
{
struct noop_data *nd = e->elevator_data;
struct clook_data *nd = e->elevator_data;

BUG_ON(!list_empty(&nd->queue));
kfree(nd);
}

static struct elevator_type elevator_noop = {
static struct elevator_type elevator_clook = {
.ops = {
.elevator_merge_req_fn = noop_merged_requests,
.elevator_dispatch_fn = noop_dispatch,
.elevator_add_req_fn = noop_add_request,
.elevator_queue_empty_fn = noop_queue_empty,
.elevator_former_req_fn = noop_former_request,
.elevator_latter_req_fn = noop_latter_request,
.elevator_init_fn = noop_init_queue,
.elevator_exit_fn = noop_exit_queue,
.elevator_merge_req_fn = clook_merged_requests,
.elevator_dispatch_fn = clook_dispatch,
.elevator_add_req_fn = clook_add_request,
.elevator_queue_empty_fn = clook_queue_empty,
.elevator_former_req_fn = clook_former_request,
.elevator_latter_req_fn = clook_latter_request,
.elevator_init_fn = clook_init_queue,
.elevator_exit_fn = clook_exit_queue,
},
.elevator_name = "noop",
.elevator_name = "clook",
.elevator_owner = THIS_MODULE,
};

static int __init noop_init(void)
static int __init clook_init(void)
{
elv_register(&elevator_noop);
elv_register(&elevator_clook);

return 0;
}

static void __exit noop_exit(void)
static void __exit clook_exit(void)
{
elv_unregister(&elevator_noop);
elv_unregister(&elevator_clook);
}

module_init(noop_init);
module_exit(noop_exit);
module_init(clook_init);
module_exit(clook_exit);


MODULE_AUTHOR("Mark Oleson & Alexis Jefferson");
Expand Down

0 comments on commit e4594b7

Please sign in to comment.