Commit 9361401eb7619c033e2394e4f9f6d410d6719ac7

Authored by David Howells
Committed by Jens Axboe
1 parent d366e40a1c

[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>

Showing 44 changed files with 308 additions and 63 deletions Side-by-side Diff

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