2005-04-16 22:20:36 +00:00
|
|
|
#ifndef _LINUX_ELEVATOR_H
|
|
|
|
#define _LINUX_ELEVATOR_H
|
|
|
|
|
2006-07-22 13:37:43 +00:00
|
|
|
#include <linux/percpu.h>
|
2012-12-17 15:01:27 +00:00
|
|
|
#include <linux/hashtable.h>
|
2006-07-22 13:37:43 +00:00
|
|
|
|
[PATCH] BLOCK: Make it possible to disable the block layer [try #6]
Make it possible to disable the block layer. Not all embedded devices require
it, some can make do with just JFFS2, NFS, ramfs, etc - none of which require
the block layer to be present.
This patch does the following:
(*) Introduces CONFIG_BLOCK to disable the block layer, buffering and blockdev
support.
(*) Adds dependencies on CONFIG_BLOCK to any configuration item that controls
an item that uses the block layer. This includes:
(*) Block I/O tracing.
(*) Disk partition code.
(*) All filesystems that are block based, eg: Ext3, ReiserFS, ISOFS.
(*) The SCSI layer. As far as I can tell, even SCSI chardevs use the
block layer to do scheduling. Some drivers that use SCSI facilities -
such as USB storage - end up disabled indirectly from this.
(*) Various block-based device drivers, such as IDE and the old CDROM
drivers.
(*) MTD blockdev handling and FTL.
(*) JFFS - which uses set_bdev_super(), something it could avoid doing by
taking a leaf out of JFFS2's book.
(*) Makes most of the contents of linux/blkdev.h, linux/buffer_head.h and
linux/elevator.h contingent on CONFIG_BLOCK being set. sector_div() is,
however, still used in places, and so is still available.
(*) Also made contingent are the contents of linux/mpage.h, linux/genhd.h and
parts of linux/fs.h.
(*) Makes a number of files in fs/ contingent on CONFIG_BLOCK.
(*) Makes mm/bounce.c (bounce buffering) contingent on CONFIG_BLOCK.
(*) set_page_dirty() doesn't call __set_page_dirty_buffers() if CONFIG_BLOCK
is not enabled.
(*) fs/no-block.c is created to hold out-of-line stubs and things that are
required when CONFIG_BLOCK is not set:
(*) Default blockdev file operations (to give error ENODEV on opening).
(*) Makes some /proc changes:
(*) /proc/devices does not list any blockdevs.
(*) /proc/diskstats and /proc/partitions are contingent on CONFIG_BLOCK.
(*) Makes some compat ioctl handling contingent on CONFIG_BLOCK.
(*) If CONFIG_BLOCK is not defined, makes sys_quotactl() return -ENODEV if
given command other than Q_SYNC or if a special device is specified.
(*) In init/do_mounts.c, no reference is made to the blockdev routines if
CONFIG_BLOCK is not defined. This does not prohibit NFS roots or JFFS2.
(*) The bdflush, ioprio_set and ioprio_get syscalls can now be absent (return
error ENOSYS by way of cond_syscall if so).
(*) The seclvl_bd_claim() and seclvl_bd_release() security calls do nothing if
CONFIG_BLOCK is not set, since they can't then happen.
Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2006-09-30 18:45:40 +00:00
|
|
|
#ifdef CONFIG_BLOCK
|
|
|
|
|
2011-12-13 23:33:42 +00:00
|
|
|
struct io_cq;
|
2013-07-03 11:25:24 +00:00
|
|
|
struct elevator_type;
|
2017-05-04 14:24:40 +00:00
|
|
|
#ifdef CONFIG_BLK_DEBUG_FS
|
|
|
|
struct blk_mq_debugfs_attr;
|
|
|
|
#endif
|
2011-12-13 23:33:42 +00:00
|
|
|
|
2017-02-08 13:46:48 +00:00
|
|
|
/*
|
|
|
|
* Return values from elevator merger
|
|
|
|
*/
|
|
|
|
enum elv_merge {
|
|
|
|
ELEVATOR_NO_MERGE = 0,
|
|
|
|
ELEVATOR_FRONT_MERGE = 1,
|
|
|
|
ELEVATOR_BACK_MERGE = 2,
|
2017-02-08 13:46:49 +00:00
|
|
|
ELEVATOR_DISCARD_MERGE = 3,
|
2017-02-08 13:46:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum elv_merge (elevator_merge_fn) (struct request_queue *, struct request **,
|
2005-04-16 22:20:36 +00:00
|
|
|
struct bio *);
|
|
|
|
|
2007-07-24 07:28:11 +00:00
|
|
|
typedef void (elevator_merge_req_fn) (struct request_queue *, struct request *, struct request *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2017-02-08 13:46:48 +00:00
|
|
|
typedef void (elevator_merged_fn) (struct request_queue *, struct request *, enum elv_merge);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2016-07-07 18:48:22 +00:00
|
|
|
typedef int (elevator_allow_bio_merge_fn) (struct request_queue *,
|
|
|
|
struct request *, struct bio *);
|
|
|
|
|
|
|
|
typedef int (elevator_allow_rq_merge_fn) (struct request_queue *,
|
|
|
|
struct request *, struct request *);
|
2006-12-20 10:04:12 +00:00
|
|
|
|
2010-04-09 04:14:23 +00:00
|
|
|
typedef void (elevator_bio_merged_fn) (struct request_queue *,
|
|
|
|
struct request *, struct bio *);
|
|
|
|
|
2007-07-24 07:28:11 +00:00
|
|
|
typedef int (elevator_dispatch_fn) (struct request_queue *, int);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-07-24 07:28:11 +00:00
|
|
|
typedef void (elevator_add_req_fn) (struct request_queue *, struct request *);
|
|
|
|
typedef struct request *(elevator_request_list_fn) (struct request_queue *, struct request *);
|
|
|
|
typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *);
|
2016-10-28 14:48:16 +00:00
|
|
|
typedef int (elevator_may_queue_fn) (struct request_queue *, unsigned int);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2011-12-13 23:33:42 +00:00
|
|
|
typedef void (elevator_init_icq_fn) (struct io_cq *);
|
2011-12-13 23:33:42 +00:00
|
|
|
typedef void (elevator_exit_icq_fn) (struct io_cq *);
|
2012-03-05 21:15:27 +00:00
|
|
|
typedef int (elevator_set_req_fn) (struct request_queue *, struct request *,
|
|
|
|
struct bio *, gfp_t);
|
2006-12-01 09:42:33 +00:00
|
|
|
typedef void (elevator_put_req_fn) (struct request *);
|
2007-07-24 07:28:11 +00:00
|
|
|
typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *);
|
|
|
|
typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-07-03 11:25:24 +00:00
|
|
|
typedef int (elevator_init_fn) (struct request_queue *,
|
|
|
|
struct elevator_type *e);
|
2008-10-31 09:05:07 +00:00
|
|
|
typedef void (elevator_exit_fn) (struct elevator_queue *);
|
2015-06-10 14:01:20 +00:00
|
|
|
typedef void (elevator_registered_fn) (struct request_queue *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
struct elevator_ops
|
|
|
|
{
|
|
|
|
elevator_merge_fn *elevator_merge_fn;
|
|
|
|
elevator_merged_fn *elevator_merged_fn;
|
|
|
|
elevator_merge_req_fn *elevator_merge_req_fn;
|
2016-07-07 18:48:22 +00:00
|
|
|
elevator_allow_bio_merge_fn *elevator_allow_bio_merge_fn;
|
|
|
|
elevator_allow_rq_merge_fn *elevator_allow_rq_merge_fn;
|
2010-04-09 04:14:23 +00:00
|
|
|
elevator_bio_merged_fn *elevator_bio_merged_fn;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-10-20 14:23:44 +00:00
|
|
|
elevator_dispatch_fn *elevator_dispatch_fn;
|
2005-04-16 22:20:36 +00:00
|
|
|
elevator_add_req_fn *elevator_add_req_fn;
|
2005-10-20 14:23:44 +00:00
|
|
|
elevator_activate_req_fn *elevator_activate_req_fn;
|
2005-04-16 22:20:36 +00:00
|
|
|
elevator_deactivate_req_fn *elevator_deactivate_req_fn;
|
|
|
|
|
|
|
|
elevator_completed_req_fn *elevator_completed_req_fn;
|
|
|
|
|
|
|
|
elevator_request_list_fn *elevator_former_req_fn;
|
|
|
|
elevator_request_list_fn *elevator_latter_req_fn;
|
|
|
|
|
2011-12-13 23:33:42 +00:00
|
|
|
elevator_init_icq_fn *elevator_init_icq_fn; /* see iocontext.h */
|
|
|
|
elevator_exit_icq_fn *elevator_exit_icq_fn; /* ditto */
|
2011-12-13 23:33:42 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
elevator_set_req_fn *elevator_set_req_fn;
|
|
|
|
elevator_put_req_fn *elevator_put_req_fn;
|
|
|
|
|
|
|
|
elevator_may_queue_fn *elevator_may_queue_fn;
|
|
|
|
|
|
|
|
elevator_init_fn *elevator_init_fn;
|
|
|
|
elevator_exit_fn *elevator_exit_fn;
|
2015-06-10 14:01:20 +00:00
|
|
|
elevator_registered_fn *elevator_registered_fn;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
2017-01-17 13:03:22 +00:00
|
|
|
struct blk_mq_alloc_data;
|
|
|
|
struct blk_mq_hw_ctx;
|
|
|
|
|
|
|
|
struct elevator_mq_ops {
|
|
|
|
int (*init_sched)(struct request_queue *, struct elevator_type *);
|
|
|
|
void (*exit_sched)(struct elevator_queue *);
|
2017-04-05 19:01:34 +00:00
|
|
|
int (*init_hctx)(struct blk_mq_hw_ctx *, unsigned int);
|
|
|
|
void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int);
|
2017-01-17 13:03:22 +00:00
|
|
|
|
|
|
|
bool (*allow_merge)(struct request_queue *, struct request *, struct bio *);
|
|
|
|
bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *);
|
|
|
|
int (*request_merge)(struct request_queue *q, struct request **, struct bio *);
|
2017-02-08 13:46:48 +00:00
|
|
|
void (*request_merged)(struct request_queue *, struct request *, enum elv_merge);
|
2017-01-17 13:03:22 +00:00
|
|
|
void (*requests_merged)(struct request_queue *, struct request *, struct request *);
|
2017-06-16 16:15:26 +00:00
|
|
|
void (*limit_depth)(unsigned int, struct blk_mq_alloc_data *);
|
|
|
|
void (*prepare_request)(struct request *, struct bio *bio);
|
2017-06-16 16:15:21 +00:00
|
|
|
void (*finish_request)(struct request *);
|
2017-01-17 13:03:22 +00:00
|
|
|
void (*insert_requests)(struct blk_mq_hw_ctx *, struct list_head *, bool);
|
2017-01-26 19:40:07 +00:00
|
|
|
struct request *(*dispatch_request)(struct blk_mq_hw_ctx *);
|
2017-01-17 13:03:22 +00:00
|
|
|
bool (*has_work)(struct blk_mq_hw_ctx *);
|
2017-04-14 08:00:01 +00:00
|
|
|
void (*completed_request)(struct request *);
|
2017-01-17 13:03:22 +00:00
|
|
|
void (*started_request)(struct request *);
|
|
|
|
void (*requeue_request)(struct request *);
|
|
|
|
struct request *(*former_request)(struct request_queue *, struct request *);
|
|
|
|
struct request *(*next_request)(struct request_queue *, struct request *);
|
|
|
|
void (*init_icq)(struct io_cq *);
|
|
|
|
void (*exit_icq)(struct io_cq *);
|
|
|
|
};
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#define ELV_NAME_MAX (16)
|
|
|
|
|
2006-03-19 03:27:18 +00:00
|
|
|
struct elv_fs_entry {
|
|
|
|
struct attribute attr;
|
2008-10-31 09:05:07 +00:00
|
|
|
ssize_t (*show)(struct elevator_queue *, char *);
|
|
|
|
ssize_t (*store)(struct elevator_queue *, const char *, size_t);
|
2006-03-19 03:27:18 +00:00
|
|
|
};
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* identifies an elevator type, such as AS or deadline
|
|
|
|
*/
|
|
|
|
struct elevator_type
|
|
|
|
{
|
2011-12-13 23:33:42 +00:00
|
|
|
/* managed by elevator core */
|
|
|
|
struct kmem_cache *icq_cache;
|
|
|
|
|
|
|
|
/* fields provided by elevator implementation */
|
2016-12-10 22:13:59 +00:00
|
|
|
union {
|
|
|
|
struct elevator_ops sq;
|
2017-01-17 13:03:22 +00:00
|
|
|
struct elevator_mq_ops mq;
|
2016-12-10 22:13:59 +00:00
|
|
|
} ops;
|
2011-12-13 23:33:42 +00:00
|
|
|
size_t icq_size; /* see iocontext.h */
|
|
|
|
size_t icq_align; /* ditto */
|
2006-03-19 03:27:18 +00:00
|
|
|
struct elv_fs_entry *elevator_attrs;
|
2005-04-16 22:20:36 +00:00
|
|
|
char elevator_name[ELV_NAME_MAX];
|
|
|
|
struct module *elevator_owner;
|
2017-01-17 13:03:22 +00:00
|
|
|
bool uses_mq;
|
2017-05-04 14:24:40 +00:00
|
|
|
#ifdef CONFIG_BLK_DEBUG_FS
|
|
|
|
const struct blk_mq_debugfs_attr *queue_debugfs_attrs;
|
|
|
|
const struct blk_mq_debugfs_attr *hctx_debugfs_attrs;
|
|
|
|
#endif
|
2011-12-13 23:33:42 +00:00
|
|
|
|
|
|
|
/* managed by elevator core */
|
2017-06-03 03:35:51 +00:00
|
|
|
char icq_cache_name[ELV_NAME_MAX + 6]; /* elvname + "_io_cq" */
|
2011-12-13 23:33:41 +00:00
|
|
|
struct list_head list;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
2012-12-17 15:01:27 +00:00
|
|
|
#define ELV_HASH_BITS 6
|
|
|
|
|
2016-12-07 15:43:31 +00:00
|
|
|
void elv_rqhash_del(struct request_queue *q, struct request *rq);
|
|
|
|
void elv_rqhash_add(struct request_queue *q, struct request *rq);
|
|
|
|
void elv_rqhash_reposition(struct request_queue *q, struct request *rq);
|
|
|
|
struct request *elv_rqhash_find(struct request_queue *q, sector_t offset);
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2006-01-09 23:09:36 +00:00
|
|
|
* each queue has an elevator_queue associated with it
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
struct elevator_queue
|
|
|
|
{
|
2011-12-13 23:33:41 +00:00
|
|
|
struct elevator_type *type;
|
2005-04-16 22:20:36 +00:00
|
|
|
void *elevator_data;
|
|
|
|
struct kobject kobj;
|
2006-03-18 23:35:43 +00:00
|
|
|
struct mutex sysfs_lock;
|
2010-10-07 07:35:16 +00:00
|
|
|
unsigned int registered:1;
|
2017-01-17 13:03:22 +00:00
|
|
|
unsigned int uses_mq:1;
|
2012-12-17 15:01:27 +00:00
|
|
|
DECLARE_HASHTABLE(hash, ELV_HASH_BITS);
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* block elevator interface
|
|
|
|
*/
|
2007-07-24 07:28:11 +00:00
|
|
|
extern void elv_dispatch_sort(struct request_queue *, struct request *);
|
|
|
|
extern void elv_dispatch_add_tail(struct request_queue *, struct request *);
|
2011-03-10 07:52:07 +00:00
|
|
|
extern void elv_add_request(struct request_queue *, struct request *, int);
|
|
|
|
extern void __elv_add_request(struct request_queue *, struct request *, int);
|
2017-02-08 13:46:48 +00:00
|
|
|
extern enum elv_merge elv_merge(struct request_queue *, struct request **,
|
|
|
|
struct bio *);
|
2007-07-24 07:28:11 +00:00
|
|
|
extern void elv_merge_requests(struct request_queue *, struct request *,
|
2005-04-16 22:20:36 +00:00
|
|
|
struct request *);
|
2017-02-08 13:46:48 +00:00
|
|
|
extern void elv_merged_request(struct request_queue *, struct request *,
|
|
|
|
enum elv_merge);
|
2010-04-09 04:14:23 +00:00
|
|
|
extern void elv_bio_merged(struct request_queue *q, struct request *,
|
|
|
|
struct bio *);
|
2017-01-17 13:03:22 +00:00
|
|
|
extern bool elv_attempt_insert_merge(struct request_queue *, struct request *);
|
2007-07-24 07:28:11 +00:00
|
|
|
extern void elv_requeue_request(struct request_queue *, struct request *);
|
|
|
|
extern struct request *elv_former_request(struct request_queue *, struct request *);
|
|
|
|
extern struct request *elv_latter_request(struct request_queue *, struct request *);
|
|
|
|
extern int elv_register_queue(struct request_queue *q);
|
|
|
|
extern void elv_unregister_queue(struct request_queue *q);
|
2016-10-28 14:48:16 +00:00
|
|
|
extern int elv_may_queue(struct request_queue *, unsigned int);
|
2007-07-24 07:28:11 +00:00
|
|
|
extern void elv_completed_request(struct request_queue *, struct request *);
|
2012-03-05 21:15:27 +00:00
|
|
|
extern int elv_set_request(struct request_queue *q, struct request *rq,
|
|
|
|
struct bio *bio, gfp_t gfp_mask);
|
2007-07-24 07:28:11 +00:00
|
|
|
extern void elv_put_request(struct request_queue *, struct request *);
|
2009-03-27 09:31:51 +00:00
|
|
|
extern void elv_drain_elevator(struct request_queue *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* io scheduler registration
|
|
|
|
*/
|
2013-01-18 22:05:56 +00:00
|
|
|
extern void __init load_default_elevator_module(void);
|
2014-06-22 22:32:48 +00:00
|
|
|
extern int elv_register(struct elevator_type *);
|
2005-04-16 22:20:36 +00:00
|
|
|
extern void elv_unregister(struct elevator_type *);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* io scheduler sysfs switching
|
|
|
|
*/
|
2007-07-24 07:28:11 +00:00
|
|
|
extern ssize_t elv_iosched_show(struct request_queue *, char *);
|
|
|
|
extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-07-24 07:28:11 +00:00
|
|
|
extern int elevator_init(struct request_queue *, char *);
|
2017-04-07 14:52:27 +00:00
|
|
|
extern void elevator_exit(struct request_queue *, struct elevator_queue *);
|
2016-07-07 18:48:22 +00:00
|
|
|
extern bool elv_bio_merge_ok(struct request *, struct bio *);
|
2013-07-03 11:25:24 +00:00
|
|
|
extern struct elevator_queue *elevator_alloc(struct request_queue *,
|
|
|
|
struct elevator_type *);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-07-13 09:55:04 +00:00
|
|
|
/*
|
|
|
|
* Helper functions.
|
|
|
|
*/
|
2007-07-24 07:28:11 +00:00
|
|
|
extern struct request *elv_rb_former_request(struct request_queue *, struct request *);
|
|
|
|
extern struct request *elv_rb_latter_request(struct request_queue *, struct request *);
|
2006-07-13 09:55:04 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* rb support functions.
|
|
|
|
*/
|
iosched: prevent aliased requests from starving other I/O
Hi, Jens,
If you recall, I posted an RFC patch for this back in July of last year:
http://lkml.org/lkml/2010/7/13/279
The basic problem is that a process can issue a never-ending stream of
async direct I/Os to the same sector on a device, thus starving out
other I/O in the system (due to the way the alias handling works in both
cfq and deadline). The solution I proposed back then was to start
dispatching from the fifo after a certain number of aliases had been
dispatched. Vivek asked why we had to treat aliases differently at all,
and I never had a good answer. So, I put together a simple patch which
allows aliases to be added to the rb tree (it adds them to the right,
though that doesn't matter as the order isn't guaranteed anyway). I
think this is the preferred solution, as it doesn't break up time slices
in CFQ or batches in deadline. I've tested it, and it does solve the
starvation issue. Let me know what you think.
Cheers,
Jeff
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2011-06-02 19:19:05 +00:00
|
|
|
extern void elv_rb_add(struct rb_root *, struct request *);
|
2006-07-13 09:55:04 +00:00
|
|
|
extern void elv_rb_del(struct rb_root *, struct request *);
|
|
|
|
extern struct request *elv_rb_find(struct rb_root *, sector_t);
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Insertion selection
|
|
|
|
*/
|
|
|
|
#define ELEVATOR_INSERT_FRONT 1
|
|
|
|
#define ELEVATOR_INSERT_BACK 2
|
|
|
|
#define ELEVATOR_INSERT_SORT 3
|
2006-01-06 08:51:03 +00:00
|
|
|
#define ELEVATOR_INSERT_REQUEUE 4
|
2011-01-25 11:43:54 +00:00
|
|
|
#define ELEVATOR_INSERT_FLUSH 5
|
2011-03-21 09:14:27 +00:00
|
|
|
#define ELEVATOR_INSERT_SORT_MERGE 6
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* return values from elevator_may_queue_fn
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
ELV_MQUEUE_MAY,
|
|
|
|
ELV_MQUEUE_NO,
|
|
|
|
ELV_MQUEUE_MUST,
|
|
|
|
};
|
|
|
|
|
2009-05-07 13:24:41 +00:00
|
|
|
#define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq))
|
2006-07-13 09:55:04 +00:00
|
|
|
#define rb_entry_rq(node) rb_entry((node), struct request, rb_node)
|
2005-10-20 14:37:00 +00:00
|
|
|
|
2006-07-11 19:49:15 +00:00
|
|
|
#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist)
|
2014-02-24 15:39:53 +00:00
|
|
|
#define rq_fifo_clear(rq) list_del_init(&(rq)->queuelist)
|
2006-07-11 19:49:15 +00:00
|
|
|
|
2013-01-18 22:05:56 +00:00
|
|
|
#else /* CONFIG_BLOCK */
|
|
|
|
|
|
|
|
static inline void load_default_elevator_module(void) { }
|
|
|
|
|
[PATCH] BLOCK: Make it possible to disable the block layer [try #6]
Make it possible to disable the block layer. Not all embedded devices require
it, some can make do with just JFFS2, NFS, ramfs, etc - none of which require
the block layer to be present.
This patch does the following:
(*) Introduces CONFIG_BLOCK to disable the block layer, buffering and blockdev
support.
(*) Adds dependencies on CONFIG_BLOCK to any configuration item that controls
an item that uses the block layer. This includes:
(*) Block I/O tracing.
(*) Disk partition code.
(*) All filesystems that are block based, eg: Ext3, ReiserFS, ISOFS.
(*) The SCSI layer. As far as I can tell, even SCSI chardevs use the
block layer to do scheduling. Some drivers that use SCSI facilities -
such as USB storage - end up disabled indirectly from this.
(*) Various block-based device drivers, such as IDE and the old CDROM
drivers.
(*) MTD blockdev handling and FTL.
(*) JFFS - which uses set_bdev_super(), something it could avoid doing by
taking a leaf out of JFFS2's book.
(*) Makes most of the contents of linux/blkdev.h, linux/buffer_head.h and
linux/elevator.h contingent on CONFIG_BLOCK being set. sector_div() is,
however, still used in places, and so is still available.
(*) Also made contingent are the contents of linux/mpage.h, linux/genhd.h and
parts of linux/fs.h.
(*) Makes a number of files in fs/ contingent on CONFIG_BLOCK.
(*) Makes mm/bounce.c (bounce buffering) contingent on CONFIG_BLOCK.
(*) set_page_dirty() doesn't call __set_page_dirty_buffers() if CONFIG_BLOCK
is not enabled.
(*) fs/no-block.c is created to hold out-of-line stubs and things that are
required when CONFIG_BLOCK is not set:
(*) Default blockdev file operations (to give error ENODEV on opening).
(*) Makes some /proc changes:
(*) /proc/devices does not list any blockdevs.
(*) /proc/diskstats and /proc/partitions are contingent on CONFIG_BLOCK.
(*) Makes some compat ioctl handling contingent on CONFIG_BLOCK.
(*) If CONFIG_BLOCK is not defined, makes sys_quotactl() return -ENODEV if
given command other than Q_SYNC or if a special device is specified.
(*) In init/do_mounts.c, no reference is made to the blockdev routines if
CONFIG_BLOCK is not defined. This does not prohibit NFS roots or JFFS2.
(*) The bdflush, ioprio_set and ioprio_get syscalls can now be absent (return
error ENOSYS by way of cond_syscall if so).
(*) The seclvl_bd_claim() and seclvl_bd_release() security calls do nothing if
CONFIG_BLOCK is not set, since they can't then happen.
Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2006-09-30 18:45:40 +00:00
|
|
|
#endif /* CONFIG_BLOCK */
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|