[RFC: 2.6 patch] block/ll_rw_blk.c: possible cleanups

From: Adrian Bunk
Date: Fri Apr 21 2006 - 12:49:42 EST


This patch contains the following possible cleanups:
- proper prototype for the following function:
- blk_dev_init()
- #if 0 the following unused global function:
- blk_queue_invalidate_tags()
- make the following needlessly global functions static:
- blk_alloc_queue_node()
- current_io_context()
- remove the following unused EXPORT_SYMBOL's:
- blk_put_queue
- blk_get_queue
- blk_rq_map_user_iov

Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>

---

block/genhd.c | 2 --
block/ll_rw_blk.c | 27 +++++++++++----------------
include/linux/blkdev.h | 5 ++---
3 files changed, 13 insertions(+), 21 deletions(-)

--- linux-2.6.17-rc1-mm3-full/include/linux/blkdev.h.old 2006-04-20 22:57:41.000000000 +0200
+++ linux-2.6.17-rc1-mm3-full/include/linux/blkdev.h 2006-04-20 23:09:31.000000000 +0200
@@ -105,7 +105,6 @@

void put_io_context(struct io_context *ioc);
void exit_io_context(void);
-struct io_context *current_io_context(gfp_t gfp_flags);
struct io_context *get_io_context(gfp_t gfp_flags);
void copy_io_context(struct io_context **pdst, struct io_context **psrc);
void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
@@ -599,6 +598,8 @@
unsigned block_size_bits;
};

+int blk_dev_init(void);
+
extern int blk_register_queue(struct gendisk *disk);
extern void blk_unregister_queue(struct gendisk *disk);
extern void register_disk(struct gendisk *dev);
@@ -738,7 +739,6 @@

int blk_get_queue(request_queue_t *);
request_queue_t *blk_alloc_queue(gfp_t);
-request_queue_t *blk_alloc_queue_node(gfp_t, int);
extern void blk_put_queue(request_queue_t *);

/*
@@ -753,7 +753,6 @@
extern int blk_queue_init_tags(request_queue_t *, int, struct blk_queue_tag *);
extern void blk_queue_free_tags(request_queue_t *);
extern int blk_queue_resize_tags(request_queue_t *, int);
-extern void blk_queue_invalidate_tags(request_queue_t *);
extern long blk_congestion_wait(int rw, long timeout);

extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *);
--- linux-2.6.17-rc1-mm3-full/block/ll_rw_blk.c.old 2006-04-20 22:58:01.000000000 +0200
+++ linux-2.6.17-rc1-mm3-full/block/ll_rw_blk.c 2006-04-20 23:08:04.000000000 +0200
@@ -40,6 +40,7 @@
static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io);
static void init_request_from_bio(struct request *req, struct bio *bio);
static int __make_request(request_queue_t *q, struct bio *bio);
+static struct io_context *current_io_context(gfp_t gfp_flags);

/*
* For the allocated request tables
@@ -1119,6 +1120,7 @@

EXPORT_SYMBOL(blk_queue_start_tag);

+#if 0
/**
* blk_queue_invalidate_tags - invalidate all pending tags
* @q: the request queue for the device
@@ -1152,8 +1154,8 @@
__elv_add_request(q, rq, ELEVATOR_INSERT_BACK, 0);
}
}
-
EXPORT_SYMBOL(blk_queue_invalidate_tags);
+#endif /* 0 */

static const char * const rq_flags[] = {
"REQ_RW",
@@ -1777,7 +1779,6 @@
{
kobject_put(&q->kobj);
}
-EXPORT_SYMBOL(blk_put_queue);

void blk_cleanup_queue(request_queue_t * q)
{
@@ -1812,15 +1813,9 @@
return 0;
}

-request_queue_t *blk_alloc_queue(gfp_t gfp_mask)
-{
- return blk_alloc_queue_node(gfp_mask, -1);
-}
-EXPORT_SYMBOL(blk_alloc_queue);
-
static struct kobj_type queue_ktype;

-request_queue_t *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
+static request_queue_t *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
{
request_queue_t *q;

@@ -1842,7 +1837,12 @@

return q;
}
-EXPORT_SYMBOL(blk_alloc_queue_node);
+
+request_queue_t *blk_alloc_queue(gfp_t gfp_mask)
+{
+ return blk_alloc_queue_node(gfp_mask, -1);
+}
+EXPORT_SYMBOL(blk_alloc_queue);

/**
* blk_init_queue - prepare a request queue for use with a block device
@@ -1945,8 +1945,6 @@
return 1;
}

-EXPORT_SYMBOL(blk_get_queue);
-
static inline void blk_free_request(request_queue_t *q, struct request *rq)
{
if (rq->flags & REQ_ELVPRIV)
@@ -2405,8 +2403,6 @@
return 0;
}

-EXPORT_SYMBOL(blk_rq_map_user_iov);
-
/**
* blk_rq_unmap_user - unmap a request with user data
* @bio: bio to be unmapped
@@ -3642,7 +3638,7 @@
* but since the current task itself holds a reference, the context can be
* used in general code, so long as it stays within `current` context.
*/
-struct io_context *current_io_context(gfp_t gfp_flags)
+static struct io_context *current_io_context(gfp_t gfp_flags)
{
struct task_struct *tsk = current;
struct io_context *ret;
@@ -3665,7 +3661,6 @@

return ret;
}
-EXPORT_SYMBOL(current_io_context);

/*
* If the current task has no IO context then create one and initialise it.
--- linux-2.6.17-rc1-mm3-full/block/genhd.c.old 2006-04-20 23:09:42.000000000 +0200
+++ linux-2.6.17-rc1-mm3-full/block/genhd.c 2006-04-20 23:09:51.000000000 +0200
@@ -285,8 +285,6 @@
#endif


-extern int blk_dev_init(void);
-
static struct kobject *base_probe(dev_t dev, int *part, void *data)
{
if (request_module("block-major-%d-%d", MAJOR(dev), MINOR(dev)) > 0)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/