aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-09-30 14:45:40 -0400
committerJens Axboe <axboe@nelson.home.kernel.dk>2006-09-30 14:52:31 -0400
commit9361401eb7619c033e2394e4f9f6d410d6719ac7 (patch)
tree04b94a71f2366988c17740d1c16cfbdec41d5d2e
parentd366e40a1cabd453be6e2609caa7e12f9ca17b1f (diff)
[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>
-rw-r--r--block/Kconfig20
-rw-r--r--block/Kconfig.iosched3
-rw-r--r--block/Makefile2
-rw-r--r--drivers/block/Kconfig4
-rw-r--r--drivers/cdrom/Kconfig2
-rw-r--r--drivers/char/Kconfig1
-rw-r--r--drivers/char/random.c4
-rw-r--r--drivers/ide/Kconfig4
-rw-r--r--drivers/md/Kconfig3
-rw-r--r--drivers/message/i2o/Kconfig2
-rw-r--r--drivers/mmc/Kconfig2
-rw-r--r--drivers/mmc/Makefile3
-rw-r--r--drivers/mtd/Kconfig12
-rw-r--r--drivers/mtd/devices/Kconfig2
-rw-r--r--drivers/s390/block/Kconfig2
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--fs/Kconfig31
-rw-r--r--fs/Makefile14
-rw-r--r--fs/compat_ioctl.c18
-rw-r--r--fs/internal.h6
-rw-r--r--fs/no-block.c22
-rw-r--r--fs/partitions/Makefile2
-rw-r--r--fs/proc/proc_misc.c11
-rw-r--r--fs/quota.c44
-rw-r--r--fs/super.c4
-rw-r--r--fs/xfs/Kconfig1
-rw-r--r--include/linux/blkdev.h50
-rw-r--r--include/linux/buffer_head.h16
-rw-r--r--include/linux/compat_ioctl.h2
-rw-r--r--include/linux/elevator.h3
-rw-r--r--include/linux/fs.h25
-rw-r--r--include/linux/genhd.h4
-rw-r--r--include/linux/mpage.h3
-rw-r--r--include/linux/raid/md.h3
-rw-r--r--include/linux/raid/md_k.h3
-rw-r--r--include/scsi/scsi_tcq.h3
-rw-r--r--init/Kconfig2
-rw-r--r--init/do_mounts.c13
-rw-r--r--kernel/sys_ni.c5
-rw-r--r--mm/Makefile2
-rw-r--r--mm/filemap.c4
-rw-r--r--mm/migrate.c2
-rw-r--r--mm/page-writeback.c8
-rw-r--r--mm/truncate.c2
44 files changed, 308 insertions, 63 deletions
diff --git a/block/Kconfig b/block/Kconfig
index b6f5f0a79655..9af6c614dfde 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -1,6 +1,24 @@
1# 1#
2# Block layer core configuration 2# Block layer core configuration
3# 3#
4config BLOCK
5 bool "Enable the block layer"
6 default y
7 help
8 This permits the block layer to be removed from the kernel if it's not
9 needed (on some embedded devices for example). If this option is
10 disabled, then blockdev files will become unusable and some
11 filesystems (such as ext3) will become unavailable.
12
13 This option will also disable SCSI character devices and USB storage
14 since they make use of various block layer definitions and
15 facilities.
16
17 Say Y here unless you know you really don't want to mount disks and
18 suchlike.
19
20if BLOCK
21
4#XXX - it makes sense to enable this only for 32-bit subarch's, not for x86_64 22#XXX - it makes sense to enable this only for 32-bit subarch's, not for x86_64
5#for instance. 23#for instance.
6config LBD 24config LBD
@@ -33,4 +51,6 @@ config LSF
33 51
34 If unsure, say Y. 52 If unsure, say Y.
35 53
54endif
55
36source block/Kconfig.iosched 56source block/Kconfig.iosched
diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched
index 48d090e266fc..903f0d3b6852 100644
--- a/block/Kconfig.iosched
+++ b/block/Kconfig.iosched
@@ -1,3 +1,4 @@
1if BLOCK
1 2
2menu "IO Schedulers" 3menu "IO Schedulers"
3 4
@@ -67,3 +68,5 @@ config DEFAULT_IOSCHED
67 default "noop" if DEFAULT_NOOP 68 default "noop" if DEFAULT_NOOP
68 69
69endmenu 70endmenu
71
72endif
diff --git a/block/Makefile b/block/Makefile
index c05de0e0037f..4b84d0d5947b 100644
--- a/block/Makefile
+++ b/block/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the kernel block layer 2# Makefile for the kernel block layer
3# 3#
4 4
5obj-y := elevator.o ll_rw_blk.o ioctl.o genhd.o scsi_ioctl.o 5obj-$(CONFIG_BLOCK) := elevator.o ll_rw_blk.o ioctl.o genhd.o scsi_ioctl.o
6 6
7obj-$(CONFIG_IOSCHED_NOOP) += noop-iosched.o 7obj-$(CONFIG_IOSCHED_NOOP) += noop-iosched.o
8obj-$(CONFIG_IOSCHED_AS) += as-iosched.o 8obj-$(CONFIG_IOSCHED_AS) += as-iosched.o
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index b5382cedf0c0..422e31d5f8e5 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -2,6 +2,8 @@
2# Block device driver configuration 2# Block device driver configuration
3# 3#
4 4
5if BLOCK
6
5menu "Block devices" 7menu "Block devices"
6 8
7config BLK_DEV_FD 9config BLK_DEV_FD
@@ -468,3 +470,5 @@ config ATA_OVER_ETH
468 devices like the Coraid EtherDrive (R) Storage Blade. 470 devices like the Coraid EtherDrive (R) Storage Blade.
469 471
470endmenu 472endmenu
473
474endif
diff --git a/drivers/cdrom/Kconfig b/drivers/cdrom/Kconfig
index ff5652d40619..4b12e9031fb3 100644
--- a/drivers/cdrom/Kconfig
+++ b/drivers/cdrom/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4 4
5menu "Old CD-ROM drivers (not SCSI, not IDE)" 5menu "Old CD-ROM drivers (not SCSI, not IDE)"
6 depends on ISA 6 depends on ISA && BLOCK
7 7
8config CD_NO_IDESCSI 8config CD_NO_IDESCSI
9 bool "Support non-SCSI/IDE/ATAPI CDROM drives" 9 bool "Support non-SCSI/IDE/ATAPI CDROM drives"
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 4cc619edf424..bde1c665d9f4 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -1006,6 +1006,7 @@ config GPIO_VR41XX
1006 1006
1007config RAW_DRIVER 1007config RAW_DRIVER
1008 tristate "RAW driver (/dev/raw/rawN) (OBSOLETE)" 1008 tristate "RAW driver (/dev/raw/rawN) (OBSOLETE)"
1009 depends on BLOCK
1009 help 1010 help
1010 The raw driver permits block devices to be bound to /dev/raw/rawN. 1011 The raw driver permits block devices to be bound to /dev/raw/rawN.
1011 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O. 1012 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O.
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 4c3a5ca9d8f7..b430a12eb819 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -655,6 +655,7 @@ void add_interrupt_randomness(int irq)
655 add_timer_randomness(irq_timer_state[irq], 0x100 + irq); 655 add_timer_randomness(irq_timer_state[irq], 0x100 + irq);
656} 656}
657 657
658#ifdef CONFIG_BLOCK
658void add_disk_randomness(struct gendisk *disk) 659void add_disk_randomness(struct gendisk *disk)
659{ 660{
660 if (!disk || !disk->random) 661 if (!disk || !disk->random)
@@ -667,6 +668,7 @@ void add_disk_randomness(struct gendisk *disk)
667} 668}
668 669
669EXPORT_SYMBOL(add_disk_randomness); 670EXPORT_SYMBOL(add_disk_randomness);
671#endif
670 672
671#define EXTRACT_SIZE 10 673#define EXTRACT_SIZE 10
672 674
@@ -918,6 +920,7 @@ void rand_initialize_irq(int irq)
918 } 920 }
919} 921}
920 922
923#ifdef CONFIG_BLOCK
921void rand_initialize_disk(struct gendisk *disk) 924void rand_initialize_disk(struct gendisk *disk)
922{ 925{
923 struct timer_rand_state *state; 926 struct timer_rand_state *state;
@@ -932,6 +935,7 @@ void rand_initialize_disk(struct gendisk *disk)
932 disk->random = state; 935 disk->random = state;
933 } 936 }
934} 937}
938#endif
935 939
936static ssize_t 940static ssize_t
937random_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos) 941random_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index b6fb167e20f6..69d627bd537a 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -4,6 +4,8 @@
4# Andre Hedrick <andre@linux-ide.org> 4# Andre Hedrick <andre@linux-ide.org>
5# 5#
6 6
7if BLOCK
8
7menu "ATA/ATAPI/MFM/RLL support" 9menu "ATA/ATAPI/MFM/RLL support"
8 10
9config IDE 11config IDE
@@ -1082,3 +1084,5 @@ config BLK_DEV_HD
1082endif 1084endif
1083 1085
1084endmenu 1086endmenu
1087
1088endif
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
index bf869ed03eed..6dd31a291d84 100644
--- a/drivers/md/Kconfig
+++ b/drivers/md/Kconfig
@@ -2,6 +2,8 @@
2# Block device driver configuration 2# Block device driver configuration
3# 3#
4 4
5if BLOCK
6
5menu "Multi-device support (RAID and LVM)" 7menu "Multi-device support (RAID and LVM)"
6 8
7config MD 9config MD
@@ -251,3 +253,4 @@ config DM_MULTIPATH_EMC
251 253
252endmenu 254endmenu
253 255
256endif
diff --git a/drivers/message/i2o/Kconfig b/drivers/message/i2o/Kconfig
index fef677103880..6443392bffff 100644
--- a/drivers/message/i2o/Kconfig
+++ b/drivers/message/i2o/Kconfig
@@ -88,7 +88,7 @@ config I2O_BUS
88 88
89config I2O_BLOCK 89config I2O_BLOCK
90 tristate "I2O Block OSM" 90 tristate "I2O Block OSM"
91 depends on I2O 91 depends on I2O && BLOCK
92 ---help--- 92 ---help---
93 Include support for the I2O Block OSM. The Block OSM presents disk 93 Include support for the I2O Block OSM. The Block OSM presents disk
94 and other structured block devices to the operating system. If you 94 and other structured block devices to the operating system. If you
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 45bcf098e762..f540bd88dc5a 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -21,7 +21,7 @@ config MMC_DEBUG
21 21
22config MMC_BLOCK 22config MMC_BLOCK
23 tristate "MMC block device driver" 23 tristate "MMC block device driver"
24 depends on MMC 24 depends on MMC && BLOCK
25 default y 25 default y
26 help 26 help
27 Say Y here to enable the MMC block device driver support. 27 Say Y here to enable the MMC block device driver support.
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index d2957e35cc6f..b1f6e03e7aa9 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -24,7 +24,8 @@ obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
24obj-$(CONFIG_MMC_OMAP) += omap.o 24obj-$(CONFIG_MMC_OMAP) += omap.o
25obj-$(CONFIG_MMC_AT91RM9200) += at91_mci.o 25obj-$(CONFIG_MMC_AT91RM9200) += at91_mci.o
26 26
27mmc_core-y := mmc.o mmc_queue.o mmc_sysfs.o 27mmc_core-y := mmc.o mmc_sysfs.o
28mmc_core-$(CONFIG_BLOCK) += mmc_queue.o
28 29
29ifeq ($(CONFIG_MMC_DEBUG),y) 30ifeq ($(CONFIG_MMC_DEBUG),y)
30EXTRA_CFLAGS += -DDEBUG 31EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index a03e862851db..a304b34c2632 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -166,7 +166,7 @@ config MTD_CHAR
166 166
167config MTD_BLOCK 167config MTD_BLOCK
168 tristate "Caching block device access to MTD devices" 168 tristate "Caching block device access to MTD devices"
169 depends on MTD 169 depends on MTD && BLOCK
170 ---help--- 170 ---help---
171 Although most flash chips have an erase size too large to be useful 171 Although most flash chips have an erase size too large to be useful
172 as block devices, it is possible to use MTD devices which are based 172 as block devices, it is possible to use MTD devices which are based
@@ -188,7 +188,7 @@ config MTD_BLOCK
188 188
189config MTD_BLOCK_RO 189config MTD_BLOCK_RO
190 tristate "Readonly block device access to MTD devices" 190 tristate "Readonly block device access to MTD devices"
191 depends on MTD_BLOCK!=y && MTD 191 depends on MTD_BLOCK!=y && MTD && BLOCK
192 help 192 help
193 This allows you to mount read-only file systems (such as cramfs) 193 This allows you to mount read-only file systems (such as cramfs)
194 from an MTD device, without the overhead (and danger) of the caching 194 from an MTD device, without the overhead (and danger) of the caching
@@ -199,7 +199,7 @@ config MTD_BLOCK_RO
199 199
200config FTL 200config FTL
201 tristate "FTL (Flash Translation Layer) support" 201 tristate "FTL (Flash Translation Layer) support"
202 depends on MTD 202 depends on MTD && BLOCK
203 ---help--- 203 ---help---
204 This provides support for the original Flash Translation Layer which 204 This provides support for the original Flash Translation Layer which
205 is part of the PCMCIA specification. It uses a kind of pseudo- 205 is part of the PCMCIA specification. It uses a kind of pseudo-
@@ -215,7 +215,7 @@ config FTL
215 215
216config NFTL 216config NFTL
217 tristate "NFTL (NAND Flash Translation Layer) support" 217 tristate "NFTL (NAND Flash Translation Layer) support"
218 depends on MTD 218 depends on MTD && BLOCK
219 ---help--- 219 ---help---
220 This provides support for the NAND Flash Translation Layer which is 220 This provides support for the NAND Flash Translation Layer which is
221 used on M-Systems' DiskOnChip devices. It uses a kind of pseudo- 221 used on M-Systems' DiskOnChip devices. It uses a kind of pseudo-
@@ -238,7 +238,7 @@ config NFTL_RW
238 238
239config INFTL 239config INFTL
240 tristate "INFTL (Inverse NAND Flash Translation Layer) support" 240 tristate "INFTL (Inverse NAND Flash Translation Layer) support"
241 depends on MTD 241 depends on MTD && BLOCK
242 ---help--- 242 ---help---
243 This provides support for the Inverse NAND Flash Translation 243 This provides support for the Inverse NAND Flash Translation
244 Layer which is used on M-Systems' newer DiskOnChip devices. It 244 Layer which is used on M-Systems' newer DiskOnChip devices. It
@@ -255,7 +255,7 @@ config INFTL
255 255
256config RFD_FTL 256config RFD_FTL
257 tristate "Resident Flash Disk (Flash Translation Layer) support" 257 tristate "Resident Flash Disk (Flash Translation Layer) support"
258 depends on MTD 258 depends on MTD && BLOCK
259 ---help--- 259 ---help---
260 This provides support for the flash translation layer known 260 This provides support for the flash translation layer known
261 as the Resident Flash Disk (RFD), as used by the Embedded BIOS 261 as the Resident Flash Disk (RFD), as used by the Embedded BIOS
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index 16c02b5ccf7e..440f6851da69 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -136,7 +136,7 @@ config MTDRAM_ABS_POS
136 136
137config MTD_BLOCK2MTD 137config MTD_BLOCK2MTD
138 tristate "MTD using block device" 138 tristate "MTD using block device"
139 depends on MTD 139 depends on MTD && BLOCK
140 help 140 help
141 This driver allows a block device to appear as an MTD. It would 141 This driver allows a block device to appear as an MTD. It would
142 generally be used in the following cases: 142 generally be used in the following cases:
diff --git a/drivers/s390/block/Kconfig b/drivers/s390/block/Kconfig
index 929d6fff6152..b250c5354503 100644
--- a/drivers/s390/block/Kconfig
+++ b/drivers/s390/block/Kconfig
@@ -1,4 +1,4 @@
1if S390 1if S390 && BLOCK
2 2
3comment "S/390 block device drivers" 3comment "S/390 block device drivers"
4 depends on S390 4 depends on S390
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index c4dfcc91ddda..dab082002e6f 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -3,11 +3,13 @@ menu "SCSI device support"
3config RAID_ATTRS 3config RAID_ATTRS
4 tristate "RAID Transport Class" 4 tristate "RAID Transport Class"
5 default n 5 default n
6 depends on BLOCK
6 ---help--- 7 ---help---
7 Provides RAID 8 Provides RAID
8 9
9config SCSI 10config SCSI
10 tristate "SCSI device support" 11 tristate "SCSI device support"
12 depends on BLOCK
11 ---help--- 13 ---help---
12 If you want to use a SCSI hard disk, SCSI tape drive, SCSI CD-ROM or 14 If you want to use a SCSI hard disk, SCSI tape drive, SCSI CD-ROM or
13 any other SCSI device under Linux, say Y and make sure that you know 15 any other SCSI device under Linux, say Y and make sure that you know
diff --git a/fs/Kconfig b/fs/Kconfig
index 4fd9efac29ab..1453d2d164f7 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -4,6 +4,8 @@
4 4
5menu "File systems" 5menu "File systems"
6 6
7if BLOCK
8
7config EXT2_FS 9config EXT2_FS
8 tristate "Second extended fs support" 10 tristate "Second extended fs support"
9 help 11 help
@@ -399,6 +401,8 @@ config ROMFS_FS
399 If you don't know whether you need it, then you don't need it: 401 If you don't know whether you need it, then you don't need it:
400 answer N. 402 answer N.
401 403
404endif
405
402config INOTIFY 406config INOTIFY
403 bool "Inotify file change notification support" 407 bool "Inotify file change notification support"
404 default y 408 default y
@@ -530,6 +534,7 @@ config FUSE_FS
530 If you want to develop a userspace FS, or if you want to use 534 If you want to develop a userspace FS, or if you want to use
531 a filesystem based on FUSE, answer Y or M. 535 a filesystem based on FUSE, answer Y or M.
532 536
537if BLOCK
533menu "CD-ROM/DVD Filesystems" 538menu "CD-ROM/DVD Filesystems"
534 539
535config ISO9660_FS 540config ISO9660_FS
@@ -597,7 +602,9 @@ config UDF_NLS
597 depends on (UDF_FS=m && NLS) || (UDF_FS=y && NLS=y) 602 depends on (UDF_FS=m && NLS) || (UDF_FS=y && NLS=y)
598 603
599endmenu 604endmenu
605endif
600 606
607if BLOCK
601menu "DOS/FAT/NT Filesystems" 608menu "DOS/FAT/NT Filesystems"
602 609
603config FAT_FS 610config FAT_FS
@@ -782,6 +789,7 @@ config NTFS_RW
782 It is perfectly safe to say N here. 789 It is perfectly safe to say N here.
783 790
784endmenu 791endmenu
792endif
785 793
786menu "Pseudo filesystems" 794menu "Pseudo filesystems"
787 795
@@ -939,7 +947,7 @@ menu "Miscellaneous filesystems"
939 947
940config ADFS_FS 948config ADFS_FS
941 tristate "ADFS file system support (EXPERIMENTAL)" 949 tristate "ADFS file system support (EXPERIMENTAL)"
942 depends on EXPERIMENTAL 950 depends on BLOCK && EXPERIMENTAL
943 help 951 help
944 The Acorn Disc Filing System is the standard file system of the 952 The Acorn Disc Filing System is the standard file system of the
945 RiscOS operating system which runs on Acorn's ARM-based Risc PC 953 RiscOS operating system which runs on Acorn's ARM-based Risc PC
@@ -967,7 +975,7 @@ config ADFS_FS_RW
967 975
968config AFFS_FS 976config AFFS_FS
969 tristate "Amiga FFS file system support (EXPERIMENTAL)" 977 tristate "Amiga FFS file system support (EXPERIMENTAL)"
970 depends on EXPERIMENTAL 978 depends on BLOCK && EXPERIMENTAL
971 help 979 help
972 The Fast File System (FFS) is the common file system used on hard 980 The Fast File System (FFS) is the common file system used on hard
973 disks by Amiga(tm) systems since AmigaOS Version 1.3 (34.20). Say Y 981 disks by Amiga(tm) systems since AmigaOS Version 1.3 (34.20). Say Y
@@ -989,7 +997,7 @@ config AFFS_FS
989 997
990config HFS_FS 998config HFS_FS
991 tristate "Apple Macintosh file system support (EXPERIMENTAL)" 999 tristate "Apple Macintosh file system support (EXPERIMENTAL)"
992 depends on EXPERIMENTAL 1000 depends on BLOCK && EXPERIMENTAL
993 select NLS 1001 select NLS
994 help 1002 help
995 If you say Y here, you will be able to mount Macintosh-formatted 1003 If you say Y here, you will be able to mount Macintosh-formatted
@@ -1002,6 +1010,7 @@ config HFS_FS
1002 1010
1003config HFSPLUS_FS 1011config HFSPLUS_FS
1004 tristate "Apple Extended HFS file system support" 1012 tristate "Apple Extended HFS file system support"
1013 depends on BLOCK
1005 select NLS 1014 select NLS
1006 select NLS_UTF8 1015 select NLS_UTF8
1007 help 1016 help
@@ -1015,7 +1024,7 @@ config HFSPLUS_FS
1015 1024
1016config BEFS_FS 1025config BEFS_FS
1017 tristate "BeOS file system (BeFS) support (read only) (EXPERIMENTAL)" 1026 tristate "BeOS file system (BeFS) support (read only) (EXPERIMENTAL)"
1018 depends on EXPERIMENTAL 1027 depends on BLOCK && EXPERIMENTAL
1019 select NLS 1028 select NLS
1020 help 1029 help
1021 The BeOS File System (BeFS) is the native file system of Be, Inc's 1030 The BeOS File System (BeFS) is the native file system of Be, Inc's
@@ -1042,7 +1051,7 @@ config BEFS_DEBUG
1042 1051
1043config BFS_FS 1052config BFS_FS
1044 tristate "BFS file system support (EXPERIMENTAL)" 1053 tristate "BFS file system support (EXPERIMENTAL)"
1045 depends on EXPERIMENTAL 1054 depends on BLOCK && EXPERIMENTAL
1046 help 1055 help
1047 Boot File System (BFS) is a file system used under SCO UnixWare to 1056 Boot File System (BFS) is a file system used under SCO UnixWare to
1048 allow the bootloader access to the kernel image and other important 1057 allow the bootloader access to the kernel image and other important
@@ -1064,7 +1073,7 @@ config BFS_FS
1064 1073
1065config EFS_FS 1074config EFS_FS
1066 tristate "EFS file system support (read only) (EXPERIMENTAL)" 1075 tristate "EFS file system support (read only) (EXPERIMENTAL)"
1067 depends on EXPERIMENTAL 1076 depends on BLOCK && EXPERIMENTAL
1068 help 1077 help
1069 EFS is an older file system used for non-ISO9660 CD-ROMs and hard 1078 EFS is an older file system used for non-ISO9660 CD-ROMs and hard
1070 disk partitions by SGI's IRIX operating system (IRIX 6.0 and newer 1079 disk partitions by SGI's IRIX operating system (IRIX 6.0 and newer
@@ -1079,7 +1088,7 @@ config EFS_FS
1079 1088
1080config JFFS_FS 1089config JFFS_FS
1081 tristate "Journalling Flash File System (JFFS) support" 1090 tristate "Journalling Flash File System (JFFS) support"
1082 depends on MTD 1091 depends on MTD && BLOCK
1083 help 1092 help
1084 JFFS is the Journaling Flash File System developed by Axis 1093 JFFS is the Journaling Flash File System developed by Axis
1085 Communications in Sweden, aimed at providing a crash/powerdown-safe 1094 Communications in Sweden, aimed at providing a crash/powerdown-safe
@@ -1264,6 +1273,7 @@ endchoice
1264 1273
1265config CRAMFS 1274config CRAMFS
1266 tristate "Compressed ROM file system support (cramfs)" 1275 tristate "Compressed ROM file system support (cramfs)"
1276 depends on BLOCK
1267 select ZLIB_INFLATE 1277 select ZLIB_INFLATE
1268 help 1278 help
1269 Saying Y here includes support for CramFs (Compressed ROM File 1279 Saying Y here includes support for CramFs (Compressed ROM File
@@ -1283,6 +1293,7 @@ config CRAMFS
1283 1293
1284config VXFS_FS 1294config VXFS_FS
1285 tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)" 1295 tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
1296 depends on BLOCK
1286 help 1297 help
1287 FreeVxFS is a file system driver that support the VERITAS VxFS(TM) 1298 FreeVxFS is a file system driver that support the VERITAS VxFS(TM)
1288 file system format. VERITAS VxFS(TM) is the standard file system 1299 file system format. VERITAS VxFS(TM) is the standard file system
@@ -1300,6 +1311,7 @@ config VXFS_FS
1300 1311
1301config HPFS_FS 1312config HPFS_FS
1302 tristate "OS/2 HPFS file system support" 1313 tristate "OS/2 HPFS file system support"
1314 depends on BLOCK
1303 help 1315 help
1304 OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS 1316 OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS
1305 is the file system used for organizing files on OS/2 hard disk 1317 is the file system used for organizing files on OS/2 hard disk
@@ -1316,6 +1328,7 @@ config HPFS_FS
1316 1328
1317config QNX4FS_FS 1329config QNX4FS_FS
1318 tristate "QNX4 file system support (read only)" 1330 tristate "QNX4 file system support (read only)"
1331 depends on BLOCK
1319 help 1332 help
1320 This is the file system used by the real-time operating systems 1333 This is the file system used by the real-time operating systems
1321 QNX 4 and QNX 6 (the latter is also called QNX RTP). 1334 QNX 4 and QNX 6 (the latter is also called QNX RTP).
@@ -1343,6 +1356,7 @@ config QNX4FS_RW
1343 1356
1344config SYSV_FS 1357config SYSV_FS
1345 tristate "System V/Xenix/V7/Coherent file system support" 1358 tristate "System V/Xenix/V7/Coherent file system support"
1359 depends on BLOCK
1346 help 1360 help
1347 SCO, Xenix and Coherent are commercial Unix systems for Intel 1361 SCO, Xenix and Coherent are commercial Unix systems for Intel
1348 machines, and Version 7 was used on the DEC PDP-11. Saying Y 1362 machines, and Version 7 was used on the DEC PDP-11. Saying Y
@@ -1381,6 +1395,7 @@ config SYSV_FS
1381 1395
1382config UFS_FS 1396config UFS_FS
1383 tristate "UFS file system support (read only)" 1397 tristate "UFS file system support (read only)"
1398 depends on BLOCK
1384 help 1399 help
1385 BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD, 1400 BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD,
1386 OpenBSD and NeXTstep) use a file system called UFS. Some System V 1401 OpenBSD and NeXTstep) use a file system called UFS. Some System V
@@ -1959,11 +1974,13 @@ config GENERIC_ACL
1959 1974
1960endmenu 1975endmenu
1961 1976
1977if BLOCK
1962menu "Partition Types" 1978menu "Partition Types"
1963 1979
1964source "fs/partitions/Kconfig" 1980source "fs/partitions/Kconfig"
1965 1981
1966endmenu 1982endmenu
1983endif
1967 1984
1968source "fs/nls/Kconfig" 1985source "fs/nls/Kconfig"
1969 1986
diff --git a/fs/Makefile b/fs/Makefile
index 46b8cfe497b2..a503e6ce0f32 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -5,12 +5,18 @@
5# Rewritten to use lists instead of if-statements. 5# Rewritten to use lists instead of if-statements.
6# 6#
7 7
8obj-y := open.o read_write.o file_table.o buffer.o bio.o super.o \ 8obj-y := open.o read_write.o file_table.o super.o \
9 block_dev.o char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \ 9 char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
10 ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \ 10 ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \
11 attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \ 11 attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \
12 seq_file.o xattr.o libfs.o fs-writeback.o mpage.o direct-io.o \ 12 seq_file.o xattr.o libfs.o fs-writeback.o \
13 ioprio.o pnode.o drop_caches.o splice.o sync.o 13 pnode.o drop_caches.o splice.o sync.o
14
15ifeq ($(CONFIG_BLOCK),y)
16obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o
17else
18obj-y += no-block.o
19endif
14 20
15obj-$(CONFIG_INOTIFY) += inotify.o 21obj-$(CONFIG_INOTIFY) += inotify.o
16obj-$(CONFIG_INOTIFY_USER) += inotify_user.o 22obj-$(CONFIG_INOTIFY_USER) += inotify_user.o
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index e1a56437040a..64b34533edea 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -645,6 +645,7 @@ out:
645} 645}
646#endif 646#endif
647 647
648#ifdef CONFIG_BLOCK
648struct hd_geometry32 { 649struct hd_geometry32 {
649 unsigned char heads; 650 unsigned char heads;
650 unsigned char sectors; 651 unsigned char sectors;
@@ -869,6 +870,7 @@ static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
869 } 870 }
870 return err; 871 return err;
871} 872}
873#endif /* CONFIG_BLOCK */
872 874
873struct sock_fprog32 { 875struct sock_fprog32 {
874 unsigned short len; 876 unsigned short len;
@@ -992,6 +994,7 @@ static int ppp_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
992} 994}
993 995
994 996
997#ifdef CONFIG_BLOCK
995struct mtget32 { 998struct mtget32 {
996 compat_long_t mt_type; 999 compat_long_t mt_type;
997 compat_long_t mt_resid; 1000 compat_long_t mt_resid;
@@ -1164,6 +1167,7 @@ static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar
1164 1167
1165 return err; 1168 return err;
1166} 1169}
1170#endif /* CONFIG_BLOCK */
1167 1171
1168#ifdef CONFIG_VT 1172#ifdef CONFIG_VT
1169 1173
@@ -1491,6 +1495,7 @@ ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg)
1491 return -EINVAL; 1495 return -EINVAL;
1492} 1496}
1493 1497
1498#ifdef CONFIG_BLOCK
1494static int broken_blkgetsize(unsigned int fd, unsigned int cmd, unsigned long arg) 1499static int broken_blkgetsize(unsigned int fd, unsigned int cmd, unsigned long arg)
1495{ 1500{
1496 /* The mkswap binary hard codes it to Intel value :-((( */ 1501 /* The mkswap binary hard codes it to Intel value :-((( */
@@ -1525,12 +1530,14 @@ static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar
1525 1530
1526 return sys_ioctl(fd, cmd, (unsigned long)a); 1531 return sys_ioctl(fd, cmd, (unsigned long)a);
1527} 1532}
1533#endif
1528 1534
1529static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) 1535static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg)
1530{ 1536{
1531 return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); 1537 return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg);
1532} 1538}
1533 1539
1540#ifdef CONFIG_BLOCK
1534/* Fix sizeof(sizeof()) breakage */ 1541/* Fix sizeof(sizeof()) breakage */
1535#define BLKBSZGET_32 _IOR(0x12,112,int) 1542#define BLKBSZGET_32 _IOR(0x12,112,int)
1536#define BLKBSZSET_32 _IOW(0x12,113,int) 1543#define BLKBSZSET_32 _IOW(0x12,113,int)
@@ -1551,6 +1558,7 @@ static int do_blkgetsize64(unsigned int fd, unsigned int cmd,
1551{ 1558{
1552 return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg)); 1559 return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg));
1553} 1560}
1561#endif
1554 1562
1555/* Bluetooth ioctls */ 1563/* Bluetooth ioctls */
1556#define HCIUARTSETPROTO _IOW('U', 200, int) 1564#define HCIUARTSETPROTO _IOW('U', 200, int)
@@ -1571,6 +1579,7 @@ static int do_blkgetsize64(unsigned int fd, unsigned int cmd,
1571#define HIDPGETCONNLIST _IOR('H', 210, int) 1579#define HIDPGETCONNLIST _IOR('H', 210, int)
1572#define HIDPGETCONNINFO _IOR('H', 211, int) 1580#define HIDPGETCONNINFO _IOR('H', 211, int)
1573 1581
1582#ifdef CONFIG_BLOCK
1574struct floppy_struct32 { 1583struct floppy_struct32 {
1575 compat_uint_t size; 1584 compat_uint_t size;
1576 compat_uint_t sect; 1585 compat_uint_t sect;
@@ -1895,6 +1904,7 @@ out:
1895 kfree(karg); 1904 kfree(karg);
1896 return err; 1905 return err;
1897} 1906}
1907#endif
1898 1908
1899struct mtd_oob_buf32 { 1909struct mtd_oob_buf32 {
1900 u_int32_t start; 1910 u_int32_t start;
@@ -1936,6 +1946,7 @@ static int mtd_rw_oob(unsigned int fd, unsigned int cmd, unsigned long arg)
1936 return err; 1946 return err;
1937} 1947}
1938 1948
1949#ifdef CONFIG_BLOCK
1939struct raw32_config_request 1950struct raw32_config_request
1940{ 1951{
1941 compat_int_t raw_minor; 1952 compat_int_t raw_minor;
@@ -2000,6 +2011,7 @@ static int raw_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
2000 } 2011 }
2001 return ret; 2012 return ret;
2002} 2013}
2014#endif /* CONFIG_BLOCK */
2003 2015
2004struct serial_struct32 { 2016struct serial_struct32 {
2005 compat_int_t type; 2017 compat_int_t type;
@@ -2606,6 +2618,7 @@ HANDLE_IOCTL(SIOCBRDELIF, dev_ifsioc)
2606HANDLE_IOCTL(SIOCRTMSG, ret_einval) 2618HANDLE_IOCTL(SIOCRTMSG, ret_einval)
2607HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) 2619HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
2608#endif 2620#endif
2621#ifdef CONFIG_BLOCK
2609HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) 2622HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo)
2610HANDLE_IOCTL(BLKRAGET, w_long) 2623HANDLE_IOCTL(BLKRAGET, w_long)
2611HANDLE_IOCTL(BLKGETSIZE, w_long) 2624HANDLE_IOCTL(BLKGETSIZE, w_long)
@@ -2631,14 +2644,17 @@ HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans)
2631HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) 2644HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans)
2632HANDLE_IOCTL(SG_IO,sg_ioctl_trans) 2645HANDLE_IOCTL(SG_IO,sg_ioctl_trans)
2633HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) 2646HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans)
2647#endif
2634HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) 2648HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans)
2635HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) 2649HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans)
2636HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) 2650HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans)
2637HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans) 2651HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans)
2652#ifdef CONFIG_BLOCK
2638HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) 2653HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans)
2639HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) 2654HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans)
2640HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) 2655HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans)
2641HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) 2656HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans)
2657#endif
2642#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) 2658#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
2643HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) 2659HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout)
2644#ifdef CONFIG_VT 2660#ifdef CONFIG_VT
@@ -2677,12 +2693,14 @@ HANDLE_IOCTL(SONET_SETFRAMING, do_atm_ioctl)
2677HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl) 2693HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl)
2678HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) 2694HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl)
2679/* block stuff */ 2695/* block stuff */
2696#ifdef CONFIG_BLOCK
2680HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget) 2697HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget)
2681HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset) 2698HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset)
2682HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64) 2699HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64)
2683/* Raw devices */ 2700/* Raw devices */
2684HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) 2701HANDLE_IOCTL(RAW_SETBIND, raw_ioctl)
2685HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) 2702HANDLE_IOCTL(RAW_GETBIND, raw_ioctl)
2703#endif
2686/* Serial */ 2704/* Serial */
2687HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl) 2705HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl)
2688HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl) 2706HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl)
diff --git a/fs/internal.h b/fs/internal.h
index f662b703bb97..f07147d63255 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -14,10 +14,16 @@
14/* 14/*
15 * block_dev.c 15 * block_dev.c
16 */ 16 */
17#ifdef CONFIG_BLOCK
17extern struct super_block *blockdev_superblock; 18extern struct super_block *blockdev_superblock;
18extern void __init bdev_cache_init(void); 19extern void __init bdev_cache_init(void);
19 20
20#define sb_is_blkdev_sb(sb) ((sb) == blockdev_superblock) 21#define sb_is_blkdev_sb(sb) ((sb) == blockdev_superblock)
22#else
23static inline void bdev_cache_init(void) {}
24
25#define sb_is_blkdev_sb(sb) 0
26#endif
21 27
22/* 28/*
23 * char_dev.c 29 * char_dev.c
diff --git a/fs/no-block.c b/fs/no-block.c
new file mode 100644
index 000000000000..d269a93d3467
--- /dev/null
+++ b/fs/no-block.c
@@ -0,0 +1,22 @@
1/* no-block.c: implementation of routines required for non-BLOCK configuration
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/fs.h>
14
15static int no_blkdev_open(struct inode * inode, struct file * filp)
16{
17 return -ENODEV;
18}
19
20const struct file_operations def_blk_fops = {
21 .open = no_blkdev_open,
22};
diff --git a/fs/partitions/Makefile b/fs/partitions/Makefile
index d713ce6b3e12..67e665fdb7fc 100644
--- a/fs/partitions/Makefile
+++ b/fs/partitions/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := check.o 5obj-$(CONFIG_BLOCK) := check.o
6 6
7obj-$(CONFIG_ACORN_PARTITION) += acorn.o 7obj-$(CONFIG_ACORN_PARTITION) += acorn.o
8obj-$(CONFIG_AMIGA_PARTITION) += amiga.o 8obj-$(CONFIG_AMIGA_PARTITION) += amiga.o
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 5bbd60896050..66bc425f2f3d 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -277,12 +277,15 @@ static int devinfo_show(struct seq_file *f, void *v)
277 if (i == 0) 277 if (i == 0)
278 seq_printf(f, "Character devices:\n"); 278 seq_printf(f, "Character devices:\n");
279 chrdev_show(f, i); 279 chrdev_show(f, i);
280 } else { 280 }
281#ifdef CONFIG_BLOCK
282 else {
281 i -= CHRDEV_MAJOR_HASH_SIZE; 283 i -= CHRDEV_MAJOR_HASH_SIZE;
282 if (i == 0) 284 if (i == 0)
283 seq_printf(f, "\nBlock devices:\n"); 285 seq_printf(f, "\nBlock devices:\n");
284 blkdev_show(f, i); 286 blkdev_show(f, i);
285 } 287 }
288#endif
286 return 0; 289 return 0;
287} 290}
288 291
@@ -355,6 +358,7 @@ static int stram_read_proc(char *page, char **start, off_t off,
355} 358}
356#endif 359#endif
357 360
361#ifdef CONFIG_BLOCK
358extern struct seq_operations partitions_op; 362extern struct seq_operations partitions_op;
359static int partitions_open(struct inode *inode, struct file *file) 363static int partitions_open(struct inode *inode, struct file *file)
360{ 364{
@@ -378,6 +382,7 @@ static struct file_operations proc_diskstats_operations = {
378 .llseek = seq_lseek, 382 .llseek = seq_lseek,
379 .release = seq_release, 383 .release = seq_release,
380}; 384};
385#endif
381 386
382#ifdef CONFIG_MODULES 387#ifdef CONFIG_MODULES
383extern struct seq_operations modules_op; 388extern struct seq_operations modules_op;
@@ -695,7 +700,9 @@ void __init proc_misc_init(void)
695 entry->proc_fops = &proc_kmsg_operations; 700 entry->proc_fops = &proc_kmsg_operations;
696 create_seq_entry("devices", 0, &proc_devinfo_operations); 701 create_seq_entry("devices", 0, &proc_devinfo_operations);
697 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); 702 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
703#ifdef CONFIG_BLOCK
698 create_seq_entry("partitions", 0, &proc_partitions_operations); 704 create_seq_entry("partitions", 0, &proc_partitions_operations);
705#endif
699 create_seq_entry("stat", 0, &proc_stat_operations); 706 create_seq_entry("stat", 0, &proc_stat_operations);
700 create_seq_entry("interrupts", 0, &proc_interrupts_operations); 707 create_seq_entry("interrupts", 0, &proc_interrupts_operations);
701#ifdef CONFIG_SLAB 708#ifdef CONFIG_SLAB
@@ -707,7 +714,9 @@ void __init proc_misc_init(void)
707 create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); 714 create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
708 create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); 715 create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations);
709 create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations); 716 create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations);
717#ifdef CONFIG_BLOCK
710 create_seq_entry("diskstats", 0, &proc_diskstats_operations); 718 create_seq_entry("diskstats", 0, &proc_diskstats_operations);
719#endif
711#ifdef CONFIG_MODULES 720#ifdef CONFIG_MODULES
712 create_seq_entry("modules", 0, &proc_modules_operations); 721 create_seq_entry("modules", 0, &proc_modules_operations);
713#endif 722#endif
diff --git a/fs/quota.c b/fs/quota.c
index d6a2be826e29..b9dae76a0b6e 100644
--- a/fs/quota.c
+++ b/fs/quota.c
@@ -338,6 +338,34 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, void
338} 338}
339 339
340/* 340/*
341 * look up a superblock on which quota ops will be performed
342 * - use the name of a block device to find the superblock thereon
343 */
344static inline struct super_block *quotactl_block(const char __user *special)
345{
346#ifdef CONFIG_BLOCK
347 struct block_device *bdev;
348 struct super_block *sb;
349 char *tmp = getname(special);
350
351 if (IS_ERR(tmp))
352 return ERR_PTR(PTR_ERR(tmp));
353 bdev = lookup_bdev(tmp);
354 putname(tmp);
355 if (IS_ERR(bdev))
356 return ERR_PTR(PTR_ERR(bdev));
357 sb = get_super(bdev);
358 bdput(bdev);
359 if (!sb)
360 return ERR_PTR(-ENODEV);
361
362 return sb;
363#else
364 return ERR_PTR(-ENODEV);
365#endif
366}
367
368/*
341 * This is the system call interface. This communicates with 369 * This is the system call interface. This communicates with
342 * the user-level programs. Currently this only supports diskquota 370 * the user-level programs. Currently this only supports diskquota
343 * calls. Maybe we need to add the process quotas etc. in the future, 371 * calls. Maybe we need to add the process quotas etc. in the future,
@@ -347,25 +375,15 @@ asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, qid_t
347{ 375{
348 uint cmds, type; 376 uint cmds, type;
349 struct super_block *sb = NULL; 377 struct super_block *sb = NULL;
350 struct block_device *bdev;
351 char *tmp;
352 int ret; 378 int ret;
353 379
354 cmds = cmd >> SUBCMDSHIFT; 380 cmds = cmd >> SUBCMDSHIFT;
355 type = cmd & SUBCMDMASK; 381 type = cmd & SUBCMDMASK;
356 382
357 if (cmds != Q_SYNC || special) { 383 if (cmds != Q_SYNC || special) {
358 tmp = getname(special); 384 sb = quotactl_block(special);
359 if (IS_ERR(tmp)) 385 if (IS_ERR(sb))
360 return PTR_ERR(tmp); 386 return PTR_ERR(sb);
361 bdev = lookup_bdev(tmp);
362 putname(tmp);
363 if (IS_ERR(bdev))
364 return PTR_ERR(bdev);
365 sb = get_super(bdev);
366 bdput(bdev);
367 if (!sb)
368 return -ENODEV;
369 } 387 }
370 388
371 ret = check_quotactl_valid(sb, type, cmds, id); 389 ret = check_quotactl_valid(sb, type, cmds, id);
diff --git a/fs/super.c b/fs/super.c
index 15671cd048b1..aec99ddbe53f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -571,8 +571,10 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
571{ 571{
572 int retval; 572 int retval;
573 573
574#ifdef CONFIG_BLOCK
574 if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev)) 575 if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev))
575 return -EACCES; 576 return -EACCES;
577#endif
576 if (flags & MS_RDONLY) 578 if (flags & MS_RDONLY)
577 acct_auto_close(sb); 579 acct_auto_close(sb);
578 shrink_dcache_sb(sb); 580 shrink_dcache_sb(sb);
@@ -692,6 +694,7 @@ void kill_litter_super(struct super_block *sb)
692 694
693EXPORT_SYMBOL(kill_litter_super); 695EXPORT_SYMBOL(kill_litter_super);
694 696
697#ifdef CONFIG_BLOCK
695static int set_bdev_super(struct super_block *s, void *data) 698static int set_bdev_super(struct super_block *s, void *data)
696{ 699{
697 s->s_bdev = data; 700 s->s_bdev = data;
@@ -787,6 +790,7 @@ void kill_block_super(struct super_block *sb)
787} 790}
788 791
789EXPORT_SYMBOL(kill_block_super); 792EXPORT_SYMBOL(kill_block_super);
793#endif
790 794
791int get_sb_nodev(struct file_system_type *fs_type, 795int get_sb_nodev(struct file_system_type *fs_type,
792 int flags, void *data, 796 int flags, void *data,
diff --git a/fs/xfs/Kconfig b/fs/xfs/Kconfig
index 26b364c9d62c..35115bca036e 100644
--- a/fs/xfs/Kconfig
+++ b/fs/xfs/Kconfig
@@ -1,5 +1,6 @@
1config XFS_FS 1config XFS_FS
2 tristate "XFS filesystem support" 2 tristate "XFS filesystem support"
3 depends on BLOCK
3 help 4 help
4 XFS is a high performance journaling filesystem which originated 5 XFS is a high performance journaling filesystem which originated
5 on the SGI IRIX platform. It is completely multi-threaded, can 6 on the SGI IRIX platform. It is completely multi-threaded, can
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2c01a90998a7..3e36107d342a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -16,6 +16,22 @@
16 16
17#include <asm/scatterlist.h> 17#include <asm/scatterlist.h>
18 18
19#ifdef CONFIG_LBD
20# include <asm/div64.h>
21# define sector_div(a, b) do_div(a, b)
22#else
23# define sector_div(n, b)( \
24{ \
25 int _res; \
26 _res = (n) % (b); \
27 (n) /= (b); \
28 _res; \
29} \
30)
31#endif
32
33#ifdef CONFIG_BLOCK
34
19struct scsi_ioctl_command; 35struct scsi_ioctl_command;
20 36
21struct request_queue; 37struct request_queue;
@@ -818,24 +834,30 @@ struct work_struct;
818int kblockd_schedule_work(struct work_struct *work); 834int kblockd_schedule_work(struct work_struct *work);
819void kblockd_flush(void); 835void kblockd_flush(void);
820 836
821#ifdef CONFIG_LBD
822# include <asm/div64.h>
823# define sector_div(a, b) do_div(a, b)
824#else
825# define sector_div(n, b)( \
826{ \
827 int _res; \
828 _res = (n) % (b); \
829 (n) /= (b); \
830 _res; \
831} \
832)
833#endif
834
835#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 837#define MODULE_ALIAS_BLOCKDEV(major,minor) \
836 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) 838 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
837#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ 839#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
838 MODULE_ALIAS("block-major-" __stringify(major) "-*") 840 MODULE_ALIAS("block-major-" __stringify(major) "-*")
839 841
840 842
843#else /* CONFIG_BLOCK */
844/*
845 * stubs for when the block layer is configured out
846 */
847#define buffer_heads_over_limit 0
848
849static inline long blk_congestion_wait(int rw, long timeout)
850{
851 return timeout;
852}
853
854static inline long nr_blockdev_pages(void)
855{
856 return 0;
857}
858
859static inline void exit_io_context(void) {}
860
861#endif /* CONFIG_BLOCK */
862
841#endif 863#endif
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 64b508e35d2a..131ffd37e716 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -14,6 +14,8 @@
14#include <linux/wait.h> 14#include <linux/wait.h>
15#include <asm/atomic.h> 15#include <asm/atomic.h>
16 16
17#ifdef CONFIG_BLOCK
18
17enum bh_state_bits { 19enum bh_state_bits {
18 BH_Uptodate, /* Contains valid data */ 20 BH_Uptodate, /* Contains valid data */
19 BH_Dirty, /* Is dirty */ 21 BH_Dirty, /* Is dirty */
@@ -301,4 +303,18 @@ static inline void lock_buffer(struct buffer_head *bh)
301} 303}
302 304
303extern int __set_page_dirty_buffers(struct page *page); 305extern int __set_page_dirty_buffers(struct page *page);
306
307#else /* CONFIG_BLOCK */
308
309static inline void buffer_init(void) {}
310static inline int try_to_free_buffers(struct page *page) { return 1; }
311static inline int sync_blockdev(struct block_device *bdev) { return 0; }
312static inline int inode_has_buffers(struct inode *inode) { return 0; }
313static inline void invalidate_inode_buffers(struct inode *inode) {}
314static inline int remove_inode_buffers(struct inode *inode) { return 1; }
315static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; }
316static inline void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers) {}
317
318
319#endif /* CONFIG_BLOCK */
304#endif /* _LINUX_BUFFER_HEAD_H */ 320#endif /* _LINUX_BUFFER_HEAD_H */
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index 98d40e08ba6e..d61ef5951538 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -90,6 +90,7 @@ COMPATIBLE_IOCTL(FDTWADDLE)
90COMPATIBLE_IOCTL(FDFMTTRK) 90COMPATIBLE_IOCTL(FDFMTTRK)
91COMPATIBLE_IOCTL(FDRAWCMD) 91COMPATIBLE_IOCTL(FDRAWCMD)
92/* 0x12 */ 92/* 0x12 */
93#ifdef CONFIG_BLOCK
93COMPATIBLE_IOCTL(BLKRASET) 94COMPATIBLE_IOCTL(BLKRASET)
94COMPATIBLE_IOCTL(BLKROSET) 95COMPATIBLE_IOCTL(BLKROSET)
95COMPATIBLE_IOCTL(BLKROGET) 96COMPATIBLE_IOCTL(BLKROGET)
@@ -103,6 +104,7 @@ COMPATIBLE_IOCTL(BLKTRACESETUP)
103COMPATIBLE_IOCTL(BLKTRACETEARDOWN) 104COMPATIBLE_IOCTL(BLKTRACETEARDOWN)
104ULONG_IOCTL(BLKRASET) 105ULONG_IOCTL(BLKRASET)
105ULONG_IOCTL(BLKFRASET) 106ULONG_IOCTL(BLKFRASET)
107#endif
106/* RAID */ 108/* RAID */
107COMPATIBLE_IOCTL(RAID_VERSION) 109COMPATIBLE_IOCTL(RAID_VERSION)
108COMPATIBLE_IOCTL(GET_ARRAY_INFO) 110COMPATIBLE_IOCTL(GET_ARRAY_INFO)
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 9c5a04f6114c..b3370ef5164d 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5 5
6#ifdef CONFIG_BLOCK
7
6typedef int (elevator_merge_fn) (request_queue_t *, struct request **, 8typedef int (elevator_merge_fn) (request_queue_t *, struct request **,
7 struct bio *); 9 struct bio *);
8 10
@@ -203,4 +205,5 @@ enum {
203 __val; \ 205 __val; \
204}) 206})
205 207
208#endif /* CONFIG_BLOCK */
206#endif 209#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b73a47582dbe..5baf3a153403 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1482,6 +1482,7 @@ extern void __init vfs_caches_init(unsigned long);
1482extern void putname(const char *name); 1482extern void putname(const char *name);
1483#endif 1483#endif
1484 1484
1485#ifdef CONFIG_BLOCK
1485extern int register_blkdev(unsigned int, const char *); 1486extern int register_blkdev(unsigned int, const char *);
1486extern int unregister_blkdev(unsigned int, const char *); 1487extern int unregister_blkdev(unsigned int, const char *);
1487extern struct block_device *bdget(dev_t); 1488extern struct block_device *bdget(dev_t);
@@ -1490,11 +1491,15 @@ extern void bd_forget(struct inode *inode);
1490extern void bdput(struct block_device *); 1491extern void bdput(struct block_device *);
1491extern struct block_device *open_by_devnum(dev_t, unsigned); 1492extern struct block_device *open_by_devnum(dev_t, unsigned);
1492extern struct block_device *open_partition_by_devnum(dev_t, unsigned); 1493extern struct block_device *open_partition_by_devnum(dev_t, unsigned);
1493extern const struct file_operations def_blk_fops;
1494extern const struct address_space_operations def_blk_aops; 1494extern const struct address_space_operations def_blk_aops;
1495#else
1496static inline void bd_forget(struct inode *inode) {}
1497#endif
1498extern const struct file_operations def_blk_fops;
1495extern const struct file_operations def_chr_fops; 1499extern const struct file_operations def_chr_fops;
1496extern const struct file_operations bad_sock_fops; 1500extern const struct file_operations bad_sock_fops;
1497extern const struct file_operations def_fifo_fops; 1501extern const struct file_operations def_fifo_fops;
1502#ifdef CONFIG_BLOCK
1498extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 1503extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
1499extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); 1504extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
1500extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1505extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
@@ -1510,6 +1515,7 @@ extern void bd_release_from_disk(struct block_device *, struct gendisk *);
1510#define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder) 1515#define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder)
1511#define bd_release_from_disk(bdev, disk) bd_release(bdev) 1516#define bd_release_from_disk(bdev, disk) bd_release(bdev)
1512#endif 1517#endif
1518#endif
1513 1519
1514/* fs/char_dev.c */ 1520/* fs/char_dev.c */
1515#define CHRDEV_MAJOR_HASH_SIZE 255 1521#define CHRDEV_MAJOR_HASH_SIZE 255
@@ -1523,14 +1529,19 @@ extern int chrdev_open(struct inode *, struct file *);
1523extern void chrdev_show(struct seq_file *,off_t); 1529extern void chrdev_show(struct seq_file *,off_t);
1524 1530
1525/* fs/block_dev.c */ 1531/* fs/block_dev.c */
1526#define BLKDEV_MAJOR_HASH_SIZE 255
1527#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 1532#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
1533
1534#ifdef CONFIG_BLOCK
1535#define BLKDEV_MAJOR_HASH_SIZE 255
1528extern const char *__bdevname(dev_t, char *buffer); 1536extern const char *__bdevname(dev_t, char *buffer);
1529extern const char *bdevname(struct block_device *bdev, char *buffer); 1537extern const char *bdevname(struct block_device *bdev, char *buffer);
1530extern struct block_device *lookup_bdev(const char *); 1538extern struct block_device *lookup_bdev(const char *);
1531extern struct block_device *open_bdev_excl(const char *, int, void *); 1539extern struct block_device *open_bdev_excl(const char *, int, void *);
1532extern void close_bdev_excl(struct block_device *); 1540extern void close_bdev_excl(struct block_device *);
1533extern void blkdev_show(struct seq_file *,off_t); 1541extern void blkdev_show(struct seq_file *,off_t);
1542#else
1543#define BLKDEV_MAJOR_HASH_SIZE 0
1544#endif
1534 1545
1535extern void init_special_inode(struct inode *, umode_t, dev_t); 1546extern void init_special_inode(struct inode *, umode_t, dev_t);
1536 1547
@@ -1544,6 +1555,7 @@ extern const struct file_operations rdwr_fifo_fops;
1544 1555
1545extern int fs_may_remount_ro(struct super_block *); 1556extern int fs_may_remount_ro(struct super_block *);
1546 1557
1558#ifdef CONFIG_BLOCK
1547/* 1559/*
1548 * return READ, READA, or WRITE 1560 * return READ, READA, or WRITE
1549 */ 1561 */
@@ -1555,9 +1567,10 @@ extern int fs_may_remount_ro(struct super_block *);
1555#define bio_data_dir(bio) ((bio)->bi_rw & 1) 1567#define bio_data_dir(bio) ((bio)->bi_rw & 1)
1556 1568
1557extern int check_disk_change(struct block_device *); 1569extern int check_disk_change(struct block_device *);
1558extern int invalidate_inodes(struct super_block *);
1559extern int __invalidate_device(struct block_device *); 1570extern int __invalidate_device(struct block_device *);
1560extern int invalidate_partition(struct gendisk *, int); 1571extern int invalidate_partition(struct gendisk *, int);
1572#endif
1573extern int invalidate_inodes(struct super_block *);
1561unsigned long invalidate_mapping_pages(struct address_space *mapping, 1574unsigned long invalidate_mapping_pages(struct address_space *mapping,
1562 pgoff_t start, pgoff_t end); 1575 pgoff_t start, pgoff_t end);
1563unsigned long invalidate_inode_pages(struct address_space *mapping); 1576unsigned long invalidate_inode_pages(struct address_space *mapping);
@@ -1590,7 +1603,9 @@ extern void emergency_sync(void);
1590extern void emergency_remount(void); 1603extern void emergency_remount(void);
1591extern int do_remount_sb(struct super_block *sb, int flags, 1604extern int do_remount_sb(struct super_block *sb, int flags,
1592 void *data, int force); 1605 void *data, int force);
1606#ifdef CONFIG_BLOCK
1593extern sector_t bmap(struct inode *, sector_t); 1607extern sector_t bmap(struct inode *, sector_t);
1608#endif
1594extern int notify_change(struct dentry *, struct iattr *); 1609extern int notify_change(struct dentry *, struct iattr *);
1595extern int permission(struct inode *, int, struct nameidata *); 1610extern int permission(struct inode *, int, struct nameidata *);
1596extern int generic_permission(struct inode *, int, 1611extern int generic_permission(struct inode *, int,
@@ -1673,9 +1688,11 @@ static inline void insert_inode_hash(struct inode *inode) {
1673extern struct file * get_empty_filp(void); 1688extern struct file * get_empty_filp(void);
1674extern void file_move(struct file *f, struct list_head *list); 1689extern void file_move(struct file *f, struct list_head *list);
1675extern void file_kill(struct file *f); 1690extern void file_kill(struct file *f);
1691#ifdef CONFIG_BLOCK
1676struct bio; 1692struct bio;
1677extern void submit_bio(int, struct bio *); 1693extern void submit_bio(int, struct bio *);
1678extern int bdev_read_only(struct block_device *); 1694extern int bdev_read_only(struct block_device *);
1695#endif
1679extern int set_blocksize(struct block_device *, int); 1696extern int set_blocksize(struct block_device *, int);
1680extern int sb_set_blocksize(struct super_block *, int); 1697extern int sb_set_blocksize(struct super_block *, int);
1681extern int sb_min_blocksize(struct super_block *, int); 1698extern int sb_min_blocksize(struct super_block *, int);
@@ -1756,6 +1773,7 @@ static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
1756 actor); 1773 actor);
1757} 1774}
1758 1775
1776#ifdef CONFIG_BLOCK
1759ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 1777ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1760 struct block_device *bdev, const struct iovec *iov, loff_t offset, 1778 struct block_device *bdev, const struct iovec *iov, loff_t offset,
1761 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, 1779 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
@@ -1793,6 +1811,7 @@ static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb,
1793 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 1811 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
1794 nr_segs, get_block, end_io, DIO_OWN_LOCKING); 1812 nr_segs, get_block, end_io, DIO_OWN_LOCKING);
1795} 1813}
1814#endif
1796 1815
1797extern const struct file_operations generic_ro_fops; 1816extern const struct file_operations generic_ro_fops;
1798 1817
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e4af57e87c17..41f276fdd185 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -11,6 +11,8 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13 13
14#ifdef CONFIG_BLOCK
15
14enum { 16enum {
15/* These three have identical behaviour; use the second one if DOS FDISK gets 17/* These three have identical behaviour; use the second one if DOS FDISK gets
16 confused about extended/logical partitions starting past cylinder 1023. */ 18 confused about extended/logical partitions starting past cylinder 1023. */
@@ -420,3 +422,5 @@ static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
420#endif 422#endif
421 423
422#endif 424#endif
425
426#endif
diff --git a/include/linux/mpage.h b/include/linux/mpage.h
index 517c098fde20..cc5fb75af78a 100644
--- a/include/linux/mpage.h
+++ b/include/linux/mpage.h
@@ -9,6 +9,7 @@
9 * (And no, it doesn't do the #ifdef __MPAGE_H thing, and it doesn't do 9 * (And no, it doesn't do the #ifdef __MPAGE_H thing, and it doesn't do
10 * nested includes. Get it right in the .c file). 10 * nested includes. Get it right in the .c file).
11 */ 11 */
12#ifdef CONFIG_BLOCK
12 13
13struct writeback_control; 14struct writeback_control;
14typedef int (writepage_t)(struct page *page, struct writeback_control *wbc); 15typedef int (writepage_t)(struct page *page, struct writeback_control *wbc);
@@ -20,3 +21,5 @@ int mpage_writepages(struct address_space *mapping,
20 struct writeback_control *wbc, get_block_t get_block); 21 struct writeback_control *wbc, get_block_t get_block);
21int mpage_writepage(struct page *page, get_block_t *get_block, 22int mpage_writepage(struct page *page, get_block_t *get_block,
22 struct writeback_control *wbc); 23 struct writeback_control *wbc);
24
25#endif
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index eb3e547c8fee..c588709acbbc 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -53,6 +53,8 @@
53#include <linux/raid/md_u.h> 53#include <linux/raid/md_u.h>
54#include <linux/raid/md_k.h> 54#include <linux/raid/md_k.h>
55 55
56#ifdef CONFIG_MD
57
56/* 58/*
57 * Different major versions are not compatible. 59 * Different major versions are not compatible.
58 * Different minor versions are only downward compatible. 60 * Different minor versions are only downward compatible.
@@ -95,5 +97,6 @@ extern void md_new_event(mddev_t *mddev);
95 97
96extern void md_update_sb(mddev_t * mddev); 98extern void md_update_sb(mddev_t * mddev);
97 99
100#endif /* CONFIG_MD */
98#endif 101#endif
99 102
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index d28890295852..920b94fe31fa 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -18,6 +18,8 @@
18/* and dm-bio-list.h is not under include/linux because.... ??? */ 18/* and dm-bio-list.h is not under include/linux because.... ??? */
19#include "../../../drivers/md/dm-bio-list.h" 19#include "../../../drivers/md/dm-bio-list.h"
20 20
21#ifdef CONFIG_BLOCK
22
21#define LEVEL_MULTIPATH (-4) 23#define LEVEL_MULTIPATH (-4)
22#define LEVEL_LINEAR (-1) 24#define LEVEL_LINEAR (-1)
23#define LEVEL_FAULTY (-5) 25#define LEVEL_FAULTY (-5)
@@ -362,5 +364,6 @@ static inline void safe_put_page(struct page *p)
362 if (p) put_page(p); 364 if (p) put_page(p);
363} 365}
364 366
367#endif /* CONFIG_BLOCK */
365#endif 368#endif
366 369
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index bbf66219b769..c247a28259bc 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -6,7 +6,6 @@
6#include <scsi/scsi_device.h> 6#include <scsi/scsi_device.h>
7#include <scsi/scsi_host.h> 7#include <scsi/scsi_host.h>
8 8
9
10#define MSG_SIMPLE_TAG 0x20 9#define MSG_SIMPLE_TAG 0x20
11#define MSG_HEAD_TAG 0x21 10#define MSG_HEAD_TAG 0x21
12#define MSG_ORDERED_TAG 0x22 11#define MSG_ORDERED_TAG 0x22
@@ -14,6 +13,7 @@
14#define SCSI_NO_TAG (-1) /* identify no tag in use */ 13#define SCSI_NO_TAG (-1) /* identify no tag in use */
15 14
16 15
16#ifdef CONFIG_BLOCK
17 17
18/** 18/**
19 * scsi_get_tag_type - get the type of tag the device supports 19 * scsi_get_tag_type - get the type of tag the device supports
@@ -144,4 +144,5 @@ static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth)
144 return shost->bqt ? 0 : -ENOMEM; 144 return shost->bqt ? 0 : -ENOMEM;
145} 145}
146 146
147#endif /* CONFIG_BLOCK */
147#endif /* _SCSI_SCSI_TCQ_H */ 148#endif /* _SCSI_SCSI_TCQ_H */
diff --git a/init/Kconfig b/init/Kconfig
index 4381006dd666..d2eb7a84a264 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -92,7 +92,7 @@ config LOCALVERSION_AUTO
92 92
93config SWAP 93config SWAP
94 bool "Support for paging of anonymous memory (swap)" 94 bool "Support for paging of anonymous memory (swap)"
95 depends on MMU 95 depends on MMU && BLOCK
96 default y 96 default y
97 help 97 help
98 This option allows you to choose whether you want to have support 98 This option allows you to choose whether you want to have support
diff --git a/init/do_mounts.c b/init/do_mounts.c
index b290aadb1d3f..dc1ec0803ef9 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -285,7 +285,11 @@ void __init mount_block_root(char *name, int flags)
285{ 285{
286 char *fs_names = __getname(); 286 char *fs_names = __getname();
287 char *p; 287 char *p;
288#ifdef CONFIG_BLOCK
288 char b[BDEVNAME_SIZE]; 289 char b[BDEVNAME_SIZE];
290#else
291 const char *b = name;
292#endif
289 293
290 get_fs_names(fs_names); 294 get_fs_names(fs_names);
291retry: 295retry:
@@ -304,7 +308,9 @@ retry:
304 * Allow the user to distinguish between failed sys_open 308 * Allow the user to distinguish between failed sys_open
305 * and bad superblock on root device. 309 * and bad superblock on root device.
306 */ 310 */
311#ifdef CONFIG_BLOCK
307 __bdevname(ROOT_DEV, b); 312 __bdevname(ROOT_DEV, b);
313#endif
308 printk("VFS: Cannot open root device \"%s\" or %s\n", 314 printk("VFS: Cannot open root device \"%s\" or %s\n",
309 root_device_name, b); 315 root_device_name, b);
310 printk("Please append a correct \"root=\" boot option\n"); 316 printk("Please append a correct \"root=\" boot option\n");
@@ -316,7 +322,10 @@ retry:
316 for (p = fs_names; *p; p += strlen(p)+1) 322 for (p = fs_names; *p; p += strlen(p)+1)
317 printk(" %s", p); 323 printk(" %s", p);
318 printk("\n"); 324 printk("\n");
319 panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b)); 325#ifdef CONFIG_BLOCK
326 __bdevname(ROOT_DEV, b);
327#endif
328 panic("VFS: Unable to mount root fs on %s", b);
320out: 329out:
321 putname(fs_names); 330 putname(fs_names);
322} 331}
@@ -387,8 +396,10 @@ void __init mount_root(void)
387 change_floppy("root floppy"); 396 change_floppy("root floppy");
388 } 397 }
389#endif 398#endif
399#ifdef CONFIG_BLOCK
390 create_dev("/dev/root", ROOT_DEV); 400 create_dev("/dev/root", ROOT_DEV);
391 mount_block_root("/dev/root", root_mountflags); 401 mount_block_root("/dev/root", root_mountflags);
402#endif
392} 403}
393 404
394/* 405/*
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 6991bece67e8..7a3b2e75f040 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -134,3 +134,8 @@ cond_syscall(sys_madvise);
134cond_syscall(sys_mremap); 134cond_syscall(sys_mremap);
135cond_syscall(sys_remap_file_pages); 135cond_syscall(sys_remap_file_pages);
136cond_syscall(compat_sys_move_pages); 136cond_syscall(compat_sys_move_pages);
137
138/* block-layer dependent */
139cond_syscall(sys_bdflush);
140cond_syscall(sys_ioprio_set);
141cond_syscall(sys_ioprio_get);
diff --git a/mm/Makefile b/mm/Makefile
index 4f2166a833b9..12b3a4eee88d 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -12,7 +12,7 @@ obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
12 readahead.o swap.o truncate.o vmscan.o \ 12 readahead.o swap.o truncate.o vmscan.o \
13 prio_tree.o util.o mmzone.o vmstat.o $(mmu-y) 13 prio_tree.o util.o mmzone.o vmstat.o $(mmu-y)
14 14
15ifeq ($(CONFIG_MMU),y) 15ifeq ($(CONFIG_MMU)$(CONFIG_BLOCK),yy)
16obj-y += bounce.o 16obj-y += bounce.o
17endif 17endif
18obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o 18obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o
diff --git a/mm/filemap.c b/mm/filemap.c
index d6846de08887..c4fe97f5ace0 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2020,6 +2020,7 @@ inline int generic_write_checks(struct file *file, loff_t *pos, size_t *count, i
2020 if (unlikely(*pos + *count > inode->i_sb->s_maxbytes)) 2020 if (unlikely(*pos + *count > inode->i_sb->s_maxbytes))
2021 *count = inode->i_sb->s_maxbytes - *pos; 2021 *count = inode->i_sb->s_maxbytes - *pos;
2022 } else { 2022 } else {
2023#ifdef CONFIG_BLOCK
2023 loff_t isize; 2024 loff_t isize;
2024 if (bdev_read_only(I_BDEV(inode))) 2025 if (bdev_read_only(I_BDEV(inode)))
2025 return -EPERM; 2026 return -EPERM;
@@ -2031,6 +2032,9 @@ inline int generic_write_checks(struct file *file, loff_t *pos, size_t *count, i
2031 2032
2032 if (*pos + *count > isize) 2033 if (*pos + *count > isize)
2033 *count = isize - *pos; 2034 *count = isize - *pos;
2035#else
2036 return -EPERM;
2037#endif
2034 } 2038 }
2035 return 0; 2039 return 0;
2036} 2040}
diff --git a/mm/migrate.c b/mm/migrate.c
index 7f50e3ff54cd..ba2453f9483d 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -409,6 +409,7 @@ int migrate_page(struct address_space *mapping,
409} 409}
410EXPORT_SYMBOL(migrate_page); 410EXPORT_SYMBOL(migrate_page);
411 411
412#ifdef CONFIG_BLOCK
412/* 413/*
413 * Migration function for pages with buffers. This function can only be used 414 * Migration function for pages with buffers. This function can only be used
414 * if the underlying filesystem guarantees that no other references to "page" 415 * if the underlying filesystem guarantees that no other references to "page"
@@ -466,6 +467,7 @@ int buffer_migrate_page(struct address_space *mapping,
466 return 0; 467 return 0;
467} 468}
468EXPORT_SYMBOL(buffer_migrate_page); 469EXPORT_SYMBOL(buffer_migrate_page);
470#endif
469 471
470/* 472/*
471 * Writeback a page to clean the dirty state 473 * Writeback a page to clean the dirty state
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index ecf27839c203..c0d4ce144dec 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -807,9 +807,11 @@ int fastcall set_page_dirty(struct page *page)
807 807
808 if (likely(mapping)) { 808 if (likely(mapping)) {
809 int (*spd)(struct page *) = mapping->a_ops->set_page_dirty; 809 int (*spd)(struct page *) = mapping->a_ops->set_page_dirty;
810 if (spd) 810#ifdef CONFIG_BLOCK
811 return (*spd)(page); 811 if (!spd)
812 return __set_page_dirty_buffers(page); 812 spd = __set_page_dirty_buffers;
813#endif
814 return (*spd)(page);
813 } 815 }
814 if (!PageDirty(page)) { 816 if (!PageDirty(page)) {
815 if (!TestSetPageDirty(page)) 817 if (!TestSetPageDirty(page))
diff --git a/mm/truncate.c b/mm/truncate.c
index cd3e34b816db..8fde6580657e 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -35,8 +35,10 @@ void do_invalidatepage(struct page *page, unsigned long offset)
35{ 35{
36 void (*invalidatepage)(struct page *, unsigned long); 36 void (*invalidatepage)(struct page *, unsigned long);
37 invalidatepage = page->mapping->a_ops->invalidatepage; 37 invalidatepage = page->mapping->a_ops->invalidatepage;
38#ifdef CONFIG_BLOCK
38 if (!invalidatepage) 39 if (!invalidatepage)
39 invalidatepage = block_invalidatepage; 40 invalidatepage = block_invalidatepage;
41#endif
40 if (invalidatepage) 42 if (invalidatepage)
41 (*invalidatepage)(page, offset); 43 (*invalidatepage)(page, offset);
42} 44}