aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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 /fs
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>
Diffstat (limited to 'fs')
-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
10 files changed, 127 insertions, 26 deletions
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