aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/Kconfig31
-rw-r--r--fs/Makefile14
-rw-r--r--fs/afs/file.c2
-rw-r--r--fs/binfmt_elf.c1
-rw-r--r--fs/bio.c4
-rw-r--r--fs/block_dev.c23
-rw-r--r--fs/buffer.c174
-rw-r--r--fs/char_dev.c1
-rw-r--r--fs/cifs/file.c1
-rw-r--r--fs/cifs/inode.c1
-rw-r--r--fs/cifs/ioctl.c7
-rw-r--r--fs/compat.c10
-rw-r--r--fs/compat_ioctl.c208
-rw-r--r--fs/dcache.c4
-rw-r--r--fs/ext2/dir.c3
-rw-r--r--fs/ext2/ext2.h1
-rw-r--r--fs/ext2/file.c6
-rw-r--r--fs/ext2/ioctl.c32
-rw-r--r--fs/ext3/dir.c3
-rw-r--r--fs/ext3/file.c3
-rw-r--r--fs/ext3/inode.c5
-rw-r--r--fs/ext3/ioctl.c55
-rw-r--r--fs/ext3/namei.c3
-rw-r--r--fs/fat/dir.c56
-rw-r--r--fs/fs-writeback.c9
-rw-r--r--fs/hfsplus/hfsplus_fs.h8
-rw-r--r--fs/hfsplus/ioctl.c17
-rw-r--r--fs/inode.c21
-rw-r--r--fs/internal.h55
-rw-r--r--fs/ioprio.c19
-rw-r--r--fs/jfs/ioctl.c15
-rw-r--r--fs/mpage.c2
-rw-r--r--fs/namespace.c3
-rw-r--r--fs/nfs/write.c1
-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/reiserfs/dir.c3
-rw-r--r--fs/reiserfs/file.c4
-rw-r--r--fs/reiserfs/ioctl.c35
-rw-r--r--fs/splice.c2
-rw-r--r--fs/super.c35
-rw-r--r--fs/sync.c113
-rw-r--r--fs/xfs/Kconfig1
45 files changed, 595 insertions, 475 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/afs/file.c b/fs/afs/file.c
index 67d6634101fd..2e8c42639eaa 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -16,7 +16,6 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/pagemap.h> 18#include <linux/pagemap.h>
19#include <linux/buffer_head.h>
20#include "volume.h" 19#include "volume.h"
21#include "vnode.h" 20#include "vnode.h"
22#include <rxrpc/call.h> 21#include <rxrpc/call.h>
@@ -37,7 +36,6 @@ struct inode_operations afs_file_inode_operations = {
37 36
38const struct address_space_operations afs_fs_aops = { 37const struct address_space_operations afs_fs_aops = {
39 .readpage = afs_file_readpage, 38 .readpage = afs_file_readpage,
40 .sync_page = block_sync_page,
41 .set_page_dirty = __set_page_dirty_nobuffers, 39 .set_page_dirty = __set_page_dirty_nobuffers,
42 .releasepage = afs_file_releasepage, 40 .releasepage = afs_file_releasepage,
43 .invalidatepage = afs_file_invalidatepage, 41 .invalidatepage = afs_file_invalidatepage,
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 6eb48e1446ec..bad52433de69 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -46,7 +46,6 @@
46static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs); 46static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs);
47static int load_elf_library(struct file *); 47static int load_elf_library(struct file *);
48static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, int, int); 48static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, int, int);
49extern int dump_fpu (struct pt_regs *, elf_fpregset_t *);
50 49
51#ifndef elf_addr_t 50#ifndef elf_addr_t
52#define elf_addr_t unsigned long 51#define elf_addr_t unsigned long
diff --git a/fs/bio.c b/fs/bio.c
index 6a0b9ad8f8c9..8f93e939f213 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2001 Jens Axboe <axboe@suse.de> 2 * Copyright (C) 2001 Jens Axboe <axboe@kernel.dk>
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
@@ -1142,7 +1142,7 @@ static int biovec_create_pools(struct bio_set *bs, int pool_entries, int scale)
1142 struct biovec_slab *bp = bvec_slabs + i; 1142 struct biovec_slab *bp = bvec_slabs + i;
1143 mempool_t **bvp = bs->bvec_pools + i; 1143 mempool_t **bvp = bs->bvec_pools + i;
1144 1144
1145 if (i >= scale) 1145 if (pool_entries > 1 && i >= scale)
1146 pool_entries >>= 1; 1146 pool_entries >>= 1;
1147 1147
1148 *bvp = mempool_create_slab_pool(pool_entries, bp->slab); 1148 *bvp = mempool_create_slab_pool(pool_entries, bp->slab);
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 4346468139e8..0c361ea7e5a6 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -17,11 +17,13 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/blkpg.h> 18#include <linux/blkpg.h>
19#include <linux/buffer_head.h> 19#include <linux/buffer_head.h>
20#include <linux/writeback.h>
20#include <linux/mpage.h> 21#include <linux/mpage.h>
21#include <linux/mount.h> 22#include <linux/mount.h>
22#include <linux/uio.h> 23#include <linux/uio.h>
23#include <linux/namei.h> 24#include <linux/namei.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include "internal.h"
25 27
26struct bdev_inode { 28struct bdev_inode {
27 struct block_device bdev; 29 struct block_device bdev;
@@ -1313,3 +1315,24 @@ void close_bdev_excl(struct block_device *bdev)
1313} 1315}
1314 1316
1315EXPORT_SYMBOL(close_bdev_excl); 1317EXPORT_SYMBOL(close_bdev_excl);
1318
1319int __invalidate_device(struct block_device *bdev)
1320{
1321 struct super_block *sb = get_super(bdev);
1322 int res = 0;
1323
1324 if (sb) {
1325 /*
1326 * no need to lock the super, get_super holds the
1327 * read mutex so the filesystem cannot go away
1328 * under us (->put_super runs with the write lock
1329 * hold).
1330 */
1331 shrink_dcache_sb(sb);
1332 res = invalidate_inodes(sb);
1333 drop_super(sb);
1334 }
1335 invalidate_bdev(bdev, 0);
1336 return res;
1337}
1338EXPORT_SYMBOL(__invalidate_device);
diff --git a/fs/buffer.c b/fs/buffer.c
index 3b6d701073e7..16cfbcd254f1 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -159,31 +159,6 @@ int sync_blockdev(struct block_device *bdev)
159} 159}
160EXPORT_SYMBOL(sync_blockdev); 160EXPORT_SYMBOL(sync_blockdev);
161 161
162static void __fsync_super(struct super_block *sb)
163{
164 sync_inodes_sb(sb, 0);
165 DQUOT_SYNC(sb);
166 lock_super(sb);
167 if (sb->s_dirt && sb->s_op->write_super)
168 sb->s_op->write_super(sb);
169 unlock_super(sb);
170 if (sb->s_op->sync_fs)
171 sb->s_op->sync_fs(sb, 1);
172 sync_blockdev(sb->s_bdev);
173 sync_inodes_sb(sb, 1);
174}
175
176/*
177 * Write out and wait upon all dirty data associated with this
178 * superblock. Filesystem data as well as the underlying block
179 * device. Takes the superblock lock.
180 */
181int fsync_super(struct super_block *sb)
182{
183 __fsync_super(sb);
184 return sync_blockdev(sb->s_bdev);
185}
186
187/* 162/*
188 * Write out and wait upon all dirty data associated with this 163 * Write out and wait upon all dirty data associated with this
189 * device. Filesystem data as well as the underlying block 164 * device. Filesystem data as well as the underlying block
@@ -260,118 +235,6 @@ void thaw_bdev(struct block_device *bdev, struct super_block *sb)
260EXPORT_SYMBOL(thaw_bdev); 235EXPORT_SYMBOL(thaw_bdev);
261 236
262/* 237/*
263 * sync everything. Start out by waking pdflush, because that writes back
264 * all queues in parallel.
265 */
266static void do_sync(unsigned long wait)
267{
268 wakeup_pdflush(0);
269 sync_inodes(0); /* All mappings, inodes and their blockdevs */
270 DQUOT_SYNC(NULL);
271 sync_supers(); /* Write the superblocks */
272 sync_filesystems(0); /* Start syncing the filesystems */
273 sync_filesystems(wait); /* Waitingly sync the filesystems */
274 sync_inodes(wait); /* Mappings, inodes and blockdevs, again. */
275 if (!wait)
276 printk("Emergency Sync complete\n");
277 if (unlikely(laptop_mode))
278 laptop_sync_completion();
279}
280
281asmlinkage long sys_sync(void)
282{
283 do_sync(1);
284 return 0;
285}
286
287void emergency_sync(void)
288{
289 pdflush_operation(do_sync, 0);
290}
291
292/*
293 * Generic function to fsync a file.
294 *
295 * filp may be NULL if called via the msync of a vma.
296 */
297
298int file_fsync(struct file *filp, struct dentry *dentry, int datasync)
299{
300 struct inode * inode = dentry->d_inode;
301 struct super_block * sb;
302 int ret, err;
303
304 /* sync the inode to buffers */
305 ret = write_inode_now(inode, 0);
306
307 /* sync the superblock to buffers */
308 sb = inode->i_sb;
309 lock_super(sb);
310 if (sb->s_op->write_super)
311 sb->s_op->write_super(sb);
312 unlock_super(sb);
313
314 /* .. finally sync the buffers to disk */
315 err = sync_blockdev(sb->s_bdev);
316 if (!ret)
317 ret = err;
318 return ret;
319}
320
321long do_fsync(struct file *file, int datasync)
322{
323 int ret;
324 int err;
325 struct address_space *mapping = file->f_mapping;
326
327 if (!file->f_op || !file->f_op->fsync) {
328 /* Why? We can still call filemap_fdatawrite */
329 ret = -EINVAL;
330 goto out;
331 }
332
333 ret = filemap_fdatawrite(mapping);
334
335 /*
336 * We need to protect against concurrent writers, which could cause
337 * livelocks in fsync_buffers_list().
338 */
339 mutex_lock(&mapping->host->i_mutex);
340 err = file->f_op->fsync(file, file->f_dentry, datasync);
341 if (!ret)
342 ret = err;
343 mutex_unlock(&mapping->host->i_mutex);
344 err = filemap_fdatawait(mapping);
345 if (!ret)
346 ret = err;
347out:
348 return ret;
349}
350
351static long __do_fsync(unsigned int fd, int datasync)
352{
353 struct file *file;
354 int ret = -EBADF;
355
356 file = fget(fd);
357 if (file) {
358 ret = do_fsync(file, datasync);
359 fput(file);
360 }
361 return ret;
362}
363
364asmlinkage long sys_fsync(unsigned int fd)
365{
366 return __do_fsync(fd, 0);
367}
368
369asmlinkage long sys_fdatasync(unsigned int fd)
370{
371 return __do_fsync(fd, 1);
372}
373
374/*
375 * Various filesystems appear to want __find_get_block to be non-blocking. 238 * Various filesystems appear to want __find_get_block to be non-blocking.
376 * But it's the page lock which protects the buffers. To get around this, 239 * But it's the page lock which protects the buffers. To get around this,
377 * we get exclusion from try_to_free_buffers with the blockdev mapping's 240 * we get exclusion from try_to_free_buffers with the blockdev mapping's
@@ -1551,35 +1414,6 @@ static void discard_buffer(struct buffer_head * bh)
1551} 1414}
1552 1415
1553/** 1416/**
1554 * try_to_release_page() - release old fs-specific metadata on a page
1555 *
1556 * @page: the page which the kernel is trying to free
1557 * @gfp_mask: memory allocation flags (and I/O mode)
1558 *
1559 * The address_space is to try to release any data against the page
1560 * (presumably at page->private). If the release was successful, return `1'.
1561 * Otherwise return zero.
1562 *
1563 * The @gfp_mask argument specifies whether I/O may be performed to release
1564 * this page (__GFP_IO), and whether the call may block (__GFP_WAIT).
1565 *
1566 * NOTE: @gfp_mask may go away, and this function may become non-blocking.
1567 */
1568int try_to_release_page(struct page *page, gfp_t gfp_mask)
1569{
1570 struct address_space * const mapping = page->mapping;
1571
1572 BUG_ON(!PageLocked(page));
1573 if (PageWriteback(page))
1574 return 0;
1575
1576 if (mapping && mapping->a_ops->releasepage)
1577 return mapping->a_ops->releasepage(page, gfp_mask);
1578 return try_to_free_buffers(page);
1579}
1580EXPORT_SYMBOL(try_to_release_page);
1581
1582/**
1583 * block_invalidatepage - invalidate part of all of a buffer-backed page 1417 * block_invalidatepage - invalidate part of all of a buffer-backed page
1584 * 1418 *
1585 * @page: the page which is affected 1419 * @page: the page which is affected
@@ -1630,14 +1464,6 @@ out:
1630} 1464}
1631EXPORT_SYMBOL(block_invalidatepage); 1465EXPORT_SYMBOL(block_invalidatepage);
1632 1466
1633void do_invalidatepage(struct page *page, unsigned long offset)
1634{
1635 void (*invalidatepage)(struct page *, unsigned long);
1636 invalidatepage = page->mapping->a_ops->invalidatepage ? :
1637 block_invalidatepage;
1638 (*invalidatepage)(page, offset);
1639}
1640
1641/* 1467/*
1642 * We attach and possibly dirty the buffers atomically wrt 1468 * We attach and possibly dirty the buffers atomically wrt
1643 * __set_page_dirty_buffers() via private_lock. try_to_free_buffers 1469 * __set_page_dirty_buffers() via private_lock. try_to_free_buffers
diff --git a/fs/char_dev.c b/fs/char_dev.c
index 1f3285affa39..a885f46ca001 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -24,6 +24,7 @@
24#ifdef CONFIG_KMOD 24#ifdef CONFIG_KMOD
25#include <linux/kmod.h> 25#include <linux/kmod.h>
26#endif 26#endif
27#include "internal.h"
27 28
28/* 29/*
29 * capabilities for /dev/mem, /dev/kmem and similar directly mappable character 30 * capabilities for /dev/mem, /dev/kmem and similar directly mappable character
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ddb012a68023..976a691c5a68 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -25,7 +25,6 @@
25#include <linux/backing-dev.h> 25#include <linux/backing-dev.h>
26#include <linux/stat.h> 26#include <linux/stat.h>
27#include <linux/fcntl.h> 27#include <linux/fcntl.h>
28#include <linux/mpage.h>
29#include <linux/pagemap.h> 28#include <linux/pagemap.h>
30#include <linux/pagevec.h> 29#include <linux/pagevec.h>
31#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index b88147c1dc27..05f874c7441b 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -19,7 +19,6 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/buffer_head.h>
23#include <linux/stat.h> 22#include <linux/stat.h>
24#include <linux/pagemap.h> 23#include <linux/pagemap.h>
25#include <asm/div64.h> 24#include <asm/div64.h>
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index b0ea6687ab55..e34c7db00f6f 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -22,7 +22,6 @@
22 */ 22 */
23 23
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <linux/ext2_fs.h>
26#include "cifspdu.h" 25#include "cifspdu.h"
27#include "cifsglob.h" 26#include "cifsglob.h"
28#include "cifsproto.h" 27#include "cifsproto.h"
@@ -74,7 +73,7 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
74 } 73 }
75 break; 74 break;
76#ifdef CONFIG_CIFS_POSIX 75#ifdef CONFIG_CIFS_POSIX
77 case EXT2_IOC_GETFLAGS: 76 case FS_IOC_GETFLAGS:
78 if(CIFS_UNIX_EXTATTR_CAP & caps) { 77 if(CIFS_UNIX_EXTATTR_CAP & caps) {
79 if (pSMBFile == NULL) 78 if (pSMBFile == NULL)
80 break; 79 break;
@@ -82,12 +81,12 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
82 &ExtAttrBits, &ExtAttrMask); 81 &ExtAttrBits, &ExtAttrMask);
83 if(rc == 0) 82 if(rc == 0)
84 rc = put_user(ExtAttrBits & 83 rc = put_user(ExtAttrBits &
85 EXT2_FL_USER_VISIBLE, 84 FS_FL_USER_VISIBLE,
86 (int __user *)arg); 85 (int __user *)arg);
87 } 86 }
88 break; 87 break;
89 88
90 case EXT2_IOC_SETFLAGS: 89 case FS_IOC_SETFLAGS:
91 if(CIFS_UNIX_EXTATTR_CAP & caps) { 90 if(CIFS_UNIX_EXTATTR_CAP & caps) {
92 if(get_user(ExtAttrBits,(int __user *)arg)) { 91 if(get_user(ExtAttrBits,(int __user *)arg)) {
93 rc = -EFAULT; 92 rc = -EFAULT;
diff --git a/fs/compat.c b/fs/compat.c
index ce982f6e8c80..122b4e3992b5 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -52,11 +52,12 @@
52#include <asm/uaccess.h> 52#include <asm/uaccess.h>
53#include <asm/mmu_context.h> 53#include <asm/mmu_context.h>
54#include <asm/ioctls.h> 54#include <asm/ioctls.h>
55 55#include "internal.h"
56extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat);
57 56
58int compat_log = 1; 57int compat_log = 1;
59 58
59extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat);
60
60int compat_printk(const char *fmt, ...) 61int compat_printk(const char *fmt, ...)
61{ 62{
62 va_list ap; 63 va_list ap;
@@ -313,9 +314,6 @@ out:
313#define IOCTL_HASHSIZE 256 314#define IOCTL_HASHSIZE 256
314static struct ioctl_trans *ioctl32_hash_table[IOCTL_HASHSIZE]; 315static struct ioctl_trans *ioctl32_hash_table[IOCTL_HASHSIZE];
315 316
316extern struct ioctl_trans ioctl_start[];
317extern int ioctl_table_size;
318
319static inline unsigned long ioctl32_hash(unsigned long cmd) 317static inline unsigned long ioctl32_hash(unsigned long cmd)
320{ 318{
321 return (((cmd >> 6) ^ (cmd >> 4) ^ cmd)) % IOCTL_HASHSIZE; 319 return (((cmd >> 6) ^ (cmd >> 4) ^ cmd)) % IOCTL_HASHSIZE;
@@ -838,8 +836,6 @@ static int do_nfs4_super_data_conv(void *raw_data)
838 return 0; 836 return 0;
839} 837}
840 838
841extern int copy_mount_options (const void __user *, unsigned long *);
842
843#define SMBFS_NAME "smbfs" 839#define SMBFS_NAME "smbfs"
844#define NCPFS_NAME "ncpfs" 840#define NCPFS_NAME "ncpfs"
845#define NFS4_NAME "nfs4" 841#define NFS4_NAME "nfs4"
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 4063a9396977..64b34533edea 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -40,15 +40,11 @@
40#include <linux/if_pppox.h> 40#include <linux/if_pppox.h>
41#include <linux/mtio.h> 41#include <linux/mtio.h>
42#include <linux/cdrom.h> 42#include <linux/cdrom.h>
43#include <linux/loop.h>
44#include <linux/auto_fs.h> 43#include <linux/auto_fs.h>
45#include <linux/auto_fs4.h> 44#include <linux/auto_fs4.h>
46#include <linux/tty.h> 45#include <linux/tty.h>
47#include <linux/vt_kern.h> 46#include <linux/vt_kern.h>
48#include <linux/fb.h> 47#include <linux/fb.h>
49#include <linux/ext2_fs.h>
50#include <linux/ext3_jbd.h>
51#include <linux/ext3_fs.h>
52#include <linux/videodev.h> 48#include <linux/videodev.h>
53#include <linux/netdevice.h> 49#include <linux/netdevice.h>
54#include <linux/raw.h> 50#include <linux/raw.h>
@@ -60,7 +56,6 @@
60#include <linux/pci.h> 56#include <linux/pci.h>
61#include <linux/module.h> 57#include <linux/module.h>
62#include <linux/serial.h> 58#include <linux/serial.h>
63#include <linux/reiserfs_fs.h>
64#include <linux/if_tun.h> 59#include <linux/if_tun.h>
65#include <linux/ctype.h> 60#include <linux/ctype.h>
66#include <linux/ioctl32.h> 61#include <linux/ioctl32.h>
@@ -113,7 +108,6 @@
113#include <linux/nbd.h> 108#include <linux/nbd.h>
114#include <linux/random.h> 109#include <linux/random.h>
115#include <linux/filter.h> 110#include <linux/filter.h>
116#include <linux/msdos_fs.h>
117#include <linux/pktcdvd.h> 111#include <linux/pktcdvd.h>
118 112
119#include <linux/hiddev.h> 113#include <linux/hiddev.h>
@@ -124,21 +118,6 @@
124#include <linux/dvb/video.h> 118#include <linux/dvb/video.h>
125#include <linux/lp.h> 119#include <linux/lp.h>
126 120
127/* Aiee. Someone does not find a difference between int and long */
128#define EXT2_IOC32_GETFLAGS _IOR('f', 1, int)
129#define EXT2_IOC32_SETFLAGS _IOW('f', 2, int)
130#define EXT3_IOC32_GETVERSION _IOR('f', 3, int)
131#define EXT3_IOC32_SETVERSION _IOW('f', 4, int)
132#define EXT3_IOC32_GETRSVSZ _IOR('f', 5, int)
133#define EXT3_IOC32_SETRSVSZ _IOW('f', 6, int)
134#define EXT3_IOC32_GROUP_EXTEND _IOW('f', 7, unsigned int)
135#ifdef CONFIG_JBD_DEBUG
136#define EXT3_IOC32_WAIT_FOR_READONLY _IOR('f', 99, int)
137#endif
138
139#define EXT2_IOC32_GETVERSION _IOR('v', 1, int)
140#define EXT2_IOC32_SETVERSION _IOW('v', 2, int)
141
142static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd, 121static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd,
143 unsigned long arg, struct file *f) 122 unsigned long arg, struct file *f)
144{ 123{
@@ -176,34 +155,6 @@ static int rw_long(unsigned int fd, unsigned int cmd, unsigned long arg)
176 return err; 155 return err;
177} 156}
178 157
179static int do_ext2_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
180{
181 /* These are just misnamed, they actually get/put from/to user an int */
182 switch (cmd) {
183 case EXT2_IOC32_GETFLAGS: cmd = EXT2_IOC_GETFLAGS; break;
184 case EXT2_IOC32_SETFLAGS: cmd = EXT2_IOC_SETFLAGS; break;
185 case EXT2_IOC32_GETVERSION: cmd = EXT2_IOC_GETVERSION; break;
186 case EXT2_IOC32_SETVERSION: cmd = EXT2_IOC_SETVERSION; break;
187 }
188 return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg));
189}
190
191static int do_ext3_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
192{
193 /* These are just misnamed, they actually get/put from/to user an int */
194 switch (cmd) {
195 case EXT3_IOC32_GETVERSION: cmd = EXT3_IOC_GETVERSION; break;
196 case EXT3_IOC32_SETVERSION: cmd = EXT3_IOC_SETVERSION; break;
197 case EXT3_IOC32_GETRSVSZ: cmd = EXT3_IOC_GETRSVSZ; break;
198 case EXT3_IOC32_SETRSVSZ: cmd = EXT3_IOC_SETRSVSZ; break;
199 case EXT3_IOC32_GROUP_EXTEND: cmd = EXT3_IOC_GROUP_EXTEND; break;
200#ifdef CONFIG_JBD_DEBUG
201 case EXT3_IOC32_WAIT_FOR_READONLY: cmd = EXT3_IOC_WAIT_FOR_READONLY; break;
202#endif
203 }
204 return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg));
205}
206
207struct compat_video_event { 158struct compat_video_event {
208 int32_t type; 159 int32_t type;
209 compat_time_t timestamp; 160 compat_time_t timestamp;
@@ -694,6 +645,7 @@ out:
694} 645}
695#endif 646#endif
696 647
648#ifdef CONFIG_BLOCK
697struct hd_geometry32 { 649struct hd_geometry32 {
698 unsigned char heads; 650 unsigned char heads;
699 unsigned char sectors; 651 unsigned char sectors;
@@ -918,6 +870,7 @@ static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
918 } 870 }
919 return err; 871 return err;
920} 872}
873#endif /* CONFIG_BLOCK */
921 874
922struct sock_fprog32 { 875struct sock_fprog32 {
923 unsigned short len; 876 unsigned short len;
@@ -1041,6 +994,7 @@ static int ppp_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
1041} 994}
1042 995
1043 996
997#ifdef CONFIG_BLOCK
1044struct mtget32 { 998struct mtget32 {
1045 compat_long_t mt_type; 999 compat_long_t mt_type;
1046 compat_long_t mt_resid; 1000 compat_long_t mt_resid;
@@ -1213,73 +1167,7 @@ static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar
1213 1167
1214 return err; 1168 return err;
1215} 1169}
1216 1170#endif /* CONFIG_BLOCK */
1217struct loop_info32 {
1218 compat_int_t lo_number; /* ioctl r/o */
1219 compat_dev_t lo_device; /* ioctl r/o */
1220 compat_ulong_t lo_inode; /* ioctl r/o */
1221 compat_dev_t lo_rdevice; /* ioctl r/o */
1222 compat_int_t lo_offset;
1223 compat_int_t lo_encrypt_type;
1224 compat_int_t lo_encrypt_key_size; /* ioctl w/o */
1225 compat_int_t lo_flags; /* ioctl r/o */
1226 char lo_name[LO_NAME_SIZE];
1227 unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
1228 compat_ulong_t lo_init[2];
1229 char reserved[4];
1230};
1231
1232static int loop_status(unsigned int fd, unsigned int cmd, unsigned long arg)
1233{
1234 mm_segment_t old_fs = get_fs();
1235 struct loop_info l;
1236 struct loop_info32 __user *ul;
1237 int err = -EINVAL;
1238
1239 ul = compat_ptr(arg);
1240 switch(cmd) {
1241 case LOOP_SET_STATUS:
1242 err = get_user(l.lo_number, &ul->lo_number);
1243 err |= __get_user(l.lo_device, &ul->lo_device);
1244 err |= __get_user(l.lo_inode, &ul->lo_inode);
1245 err |= __get_user(l.lo_rdevice, &ul->lo_rdevice);
1246 err |= __copy_from_user(&l.lo_offset, &ul->lo_offset,
1247 8 + (unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
1248 if (err) {
1249 err = -EFAULT;
1250 } else {
1251 set_fs (KERNEL_DS);
1252 err = sys_ioctl (fd, cmd, (unsigned long)&l);
1253 set_fs (old_fs);
1254 }
1255 break;
1256 case LOOP_GET_STATUS:
1257 set_fs (KERNEL_DS);
1258 err = sys_ioctl (fd, cmd, (unsigned long)&l);
1259 set_fs (old_fs);
1260 if (!err) {
1261 err = put_user(l.lo_number, &ul->lo_number);
1262 err |= __put_user(l.lo_device, &ul->lo_device);
1263 err |= __put_user(l.lo_inode, &ul->lo_inode);
1264 err |= __put_user(l.lo_rdevice, &ul->lo_rdevice);
1265 err |= __copy_to_user(&ul->lo_offset, &l.lo_offset,
1266 (unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
1267 if (err)
1268 err = -EFAULT;
1269 }
1270 break;
1271 default: {
1272 static int count;
1273 if (++count <= 20)
1274 printk("%s: Unknown loop ioctl cmd, fd(%d) "
1275 "cmd(%08x) arg(%08lx)\n",
1276 __FUNCTION__, fd, cmd, arg);
1277 }
1278 }
1279 return err;
1280}
1281
1282extern int tty_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg);
1283 1171
1284#ifdef CONFIG_VT 1172#ifdef CONFIG_VT
1285 1173
@@ -1607,6 +1495,7 @@ ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg)
1607 return -EINVAL; 1495 return -EINVAL;
1608} 1496}
1609 1497
1498#ifdef CONFIG_BLOCK
1610static 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)
1611{ 1500{
1612 /* The mkswap binary hard codes it to Intel value :-((( */ 1501 /* The mkswap binary hard codes it to Intel value :-((( */
@@ -1641,12 +1530,14 @@ static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar
1641 1530
1642 return sys_ioctl(fd, cmd, (unsigned long)a); 1531 return sys_ioctl(fd, cmd, (unsigned long)a);
1643} 1532}
1533#endif
1644 1534
1645static 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)
1646{ 1536{
1647 return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); 1537 return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg);
1648} 1538}
1649 1539
1540#ifdef CONFIG_BLOCK
1650/* Fix sizeof(sizeof()) breakage */ 1541/* Fix sizeof(sizeof()) breakage */
1651#define BLKBSZGET_32 _IOR(0x12,112,int) 1542#define BLKBSZGET_32 _IOR(0x12,112,int)
1652#define BLKBSZSET_32 _IOW(0x12,113,int) 1543#define BLKBSZSET_32 _IOW(0x12,113,int)
@@ -1667,6 +1558,7 @@ static int do_blkgetsize64(unsigned int fd, unsigned int cmd,
1667{ 1558{
1668 return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg)); 1559 return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg));
1669} 1560}
1561#endif
1670 1562
1671/* Bluetooth ioctls */ 1563/* Bluetooth ioctls */
1672#define HCIUARTSETPROTO _IOW('U', 200, int) 1564#define HCIUARTSETPROTO _IOW('U', 200, int)
@@ -1687,6 +1579,7 @@ static int do_blkgetsize64(unsigned int fd, unsigned int cmd,
1687#define HIDPGETCONNLIST _IOR('H', 210, int) 1579#define HIDPGETCONNLIST _IOR('H', 210, int)
1688#define HIDPGETCONNINFO _IOR('H', 211, int) 1580#define HIDPGETCONNINFO _IOR('H', 211, int)
1689 1581
1582#ifdef CONFIG_BLOCK
1690struct floppy_struct32 { 1583struct floppy_struct32 {
1691 compat_uint_t size; 1584 compat_uint_t size;
1692 compat_uint_t sect; 1585 compat_uint_t sect;
@@ -2011,6 +1904,7 @@ out:
2011 kfree(karg); 1904 kfree(karg);
2012 return err; 1905 return err;
2013} 1906}
1907#endif
2014 1908
2015struct mtd_oob_buf32 { 1909struct mtd_oob_buf32 {
2016 u_int32_t start; 1910 u_int32_t start;
@@ -2052,61 +1946,7 @@ static int mtd_rw_oob(unsigned int fd, unsigned int cmd, unsigned long arg)
2052 return err; 1946 return err;
2053} 1947}
2054 1948
2055#define VFAT_IOCTL_READDIR_BOTH32 _IOR('r', 1, struct compat_dirent[2]) 1949#ifdef CONFIG_BLOCK
2056#define VFAT_IOCTL_READDIR_SHORT32 _IOR('r', 2, struct compat_dirent[2])
2057
2058static long
2059put_dirent32 (struct dirent *d, struct compat_dirent __user *d32)
2060{
2061 if (!access_ok(VERIFY_WRITE, d32, sizeof(struct compat_dirent)))
2062 return -EFAULT;
2063
2064 __put_user(d->d_ino, &d32->d_ino);
2065 __put_user(d->d_off, &d32->d_off);
2066 __put_user(d->d_reclen, &d32->d_reclen);
2067 if (__copy_to_user(d32->d_name, d->d_name, d->d_reclen))
2068 return -EFAULT;
2069
2070 return 0;
2071}
2072
2073static int vfat_ioctl32(unsigned fd, unsigned cmd, unsigned long arg)
2074{
2075 struct compat_dirent __user *p = compat_ptr(arg);
2076 int ret;
2077 mm_segment_t oldfs = get_fs();
2078 struct dirent d[2];
2079
2080 switch(cmd)
2081 {
2082 case VFAT_IOCTL_READDIR_BOTH32:
2083 cmd = VFAT_IOCTL_READDIR_BOTH;
2084 break;
2085 case VFAT_IOCTL_READDIR_SHORT32:
2086 cmd = VFAT_IOCTL_READDIR_SHORT;
2087 break;
2088 }
2089
2090 set_fs(KERNEL_DS);
2091 ret = sys_ioctl(fd,cmd,(unsigned long)&d);
2092 set_fs(oldfs);
2093 if (ret >= 0) {
2094 ret |= put_dirent32(&d[0], p);
2095 ret |= put_dirent32(&d[1], p + 1);
2096 }
2097 return ret;
2098}
2099
2100#define REISERFS_IOC_UNPACK32 _IOW(0xCD,1,int)
2101
2102static int reiserfs_ioctl32(unsigned fd, unsigned cmd, unsigned long ptr)
2103{
2104 if (cmd == REISERFS_IOC_UNPACK32)
2105 cmd = REISERFS_IOC_UNPACK;
2106
2107 return sys_ioctl(fd,cmd,ptr);
2108}
2109
2110struct raw32_config_request 1950struct raw32_config_request
2111{ 1951{
2112 compat_int_t raw_minor; 1952 compat_int_t raw_minor;
@@ -2171,6 +2011,7 @@ static int raw_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
2171 } 2011 }
2172 return ret; 2012 return ret;
2173} 2013}
2014#endif /* CONFIG_BLOCK */
2174 2015
2175struct serial_struct32 { 2016struct serial_struct32 {
2176 compat_int_t type; 2017 compat_int_t type;
@@ -2777,6 +2618,7 @@ HANDLE_IOCTL(SIOCBRDELIF, dev_ifsioc)
2777HANDLE_IOCTL(SIOCRTMSG, ret_einval) 2618HANDLE_IOCTL(SIOCRTMSG, ret_einval)
2778HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) 2619HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
2779#endif 2620#endif
2621#ifdef CONFIG_BLOCK
2780HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) 2622HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo)
2781HANDLE_IOCTL(BLKRAGET, w_long) 2623HANDLE_IOCTL(BLKRAGET, w_long)
2782HANDLE_IOCTL(BLKGETSIZE, w_long) 2624HANDLE_IOCTL(BLKGETSIZE, w_long)
@@ -2802,16 +2644,17 @@ HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans)
2802HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) 2644HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans)
2803HANDLE_IOCTL(SG_IO,sg_ioctl_trans) 2645HANDLE_IOCTL(SG_IO,sg_ioctl_trans)
2804HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) 2646HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans)
2647#endif
2805HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) 2648HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans)
2806HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) 2649HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans)
2807HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) 2650HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans)
2808HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans) 2651HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans)
2652#ifdef CONFIG_BLOCK
2809HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) 2653HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans)
2810HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) 2654HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans)
2811HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) 2655HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans)
2812HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) 2656HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans)
2813HANDLE_IOCTL(LOOP_SET_STATUS, loop_status) 2657#endif
2814HANDLE_IOCTL(LOOP_GET_STATUS, loop_status)
2815#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) 2658#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
2816HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) 2659HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout)
2817#ifdef CONFIG_VT 2660#ifdef CONFIG_VT
@@ -2821,19 +2664,6 @@ HANDLE_IOCTL(PIO_UNIMAP, do_unimap_ioctl)
2821HANDLE_IOCTL(GIO_UNIMAP, do_unimap_ioctl) 2664HANDLE_IOCTL(GIO_UNIMAP, do_unimap_ioctl)
2822HANDLE_IOCTL(KDFONTOP, do_kdfontop_ioctl) 2665HANDLE_IOCTL(KDFONTOP, do_kdfontop_ioctl)
2823#endif 2666#endif
2824HANDLE_IOCTL(EXT2_IOC32_GETFLAGS, do_ext2_ioctl)
2825HANDLE_IOCTL(EXT2_IOC32_SETFLAGS, do_ext2_ioctl)
2826HANDLE_IOCTL(EXT2_IOC32_GETVERSION, do_ext2_ioctl)
2827HANDLE_IOCTL(EXT2_IOC32_SETVERSION, do_ext2_ioctl)
2828HANDLE_IOCTL(EXT3_IOC32_GETVERSION, do_ext3_ioctl)
2829HANDLE_IOCTL(EXT3_IOC32_SETVERSION, do_ext3_ioctl)
2830HANDLE_IOCTL(EXT3_IOC32_GETRSVSZ, do_ext3_ioctl)
2831HANDLE_IOCTL(EXT3_IOC32_SETRSVSZ, do_ext3_ioctl)
2832HANDLE_IOCTL(EXT3_IOC32_GROUP_EXTEND, do_ext3_ioctl)
2833COMPATIBLE_IOCTL(EXT3_IOC_GROUP_ADD)
2834#ifdef CONFIG_JBD_DEBUG
2835HANDLE_IOCTL(EXT3_IOC32_WAIT_FOR_READONLY, do_ext3_ioctl)
2836#endif
2837/* One SMB ioctl needs translations. */ 2667/* One SMB ioctl needs translations. */
2838#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t) 2668#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
2839HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid) 2669HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
@@ -2863,16 +2693,14 @@ HANDLE_IOCTL(SONET_SETFRAMING, do_atm_ioctl)
2863HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl) 2693HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl)
2864HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) 2694HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl)
2865/* block stuff */ 2695/* block stuff */
2696#ifdef CONFIG_BLOCK
2866HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget) 2697HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget)
2867HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset) 2698HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset)
2868HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64) 2699HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64)
2869/* vfat */
2870HANDLE_IOCTL(VFAT_IOCTL_READDIR_BOTH32, vfat_ioctl32)
2871HANDLE_IOCTL(VFAT_IOCTL_READDIR_SHORT32, vfat_ioctl32)
2872HANDLE_IOCTL(REISERFS_IOC_UNPACK32, reiserfs_ioctl32)
2873/* Raw devices */ 2700/* Raw devices */
2874HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) 2701HANDLE_IOCTL(RAW_SETBIND, raw_ioctl)
2875HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) 2702HANDLE_IOCTL(RAW_GETBIND, raw_ioctl)
2703#endif
2876/* Serial */ 2704/* Serial */
2877HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl) 2705HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl)
2878HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl) 2706HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl)
diff --git a/fs/dcache.c b/fs/dcache.c
index 17b392a2049e..fc2faa44f8d1 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -32,6 +32,7 @@
32#include <linux/seqlock.h> 32#include <linux/seqlock.h>
33#include <linux/swap.h> 33#include <linux/swap.h>
34#include <linux/bootmem.h> 34#include <linux/bootmem.h>
35#include "internal.h"
35 36
36 37
37int sysctl_vfs_cache_pressure __read_mostly = 100; 38int sysctl_vfs_cache_pressure __read_mostly = 100;
@@ -1877,9 +1878,6 @@ kmem_cache_t *filp_cachep __read_mostly;
1877 1878
1878EXPORT_SYMBOL(d_genocide); 1879EXPORT_SYMBOL(d_genocide);
1879 1880
1880extern void bdev_cache_init(void);
1881extern void chrdev_init(void);
1882
1883void __init vfs_caches_init_early(void) 1881void __init vfs_caches_init_early(void)
1884{ 1882{
1885 dcache_init_early(); 1883 dcache_init_early();
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 92ea8265d7d5..3e7a84a1e509 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -661,5 +661,8 @@ const struct file_operations ext2_dir_operations = {
661 .read = generic_read_dir, 661 .read = generic_read_dir,
662 .readdir = ext2_readdir, 662 .readdir = ext2_readdir,
663 .ioctl = ext2_ioctl, 663 .ioctl = ext2_ioctl,
664#ifdef CONFIG_COMPAT
665 .compat_ioctl = ext2_compat_ioctl,
666#endif
664 .fsync = ext2_sync_file, 667 .fsync = ext2_sync_file,
665}; 668};
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index e65a019fc7a5..c19ac153f56b 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -137,6 +137,7 @@ extern void ext2_set_inode_flags(struct inode *inode);
137/* ioctl.c */ 137/* ioctl.c */
138extern int ext2_ioctl (struct inode *, struct file *, unsigned int, 138extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
139 unsigned long); 139 unsigned long);
140extern long ext2_compat_ioctl(struct file *, unsigned int, unsigned long);
140 141
141/* namei.c */ 142/* namei.c */
142struct dentry *ext2_get_parent(struct dentry *child); 143struct dentry *ext2_get_parent(struct dentry *child);
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 23e2c7ccec1d..e8bbed9dd268 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -46,6 +46,9 @@ const struct file_operations ext2_file_operations = {
46 .aio_read = generic_file_aio_read, 46 .aio_read = generic_file_aio_read,
47 .aio_write = generic_file_aio_write, 47 .aio_write = generic_file_aio_write,
48 .ioctl = ext2_ioctl, 48 .ioctl = ext2_ioctl,
49#ifdef CONFIG_COMPAT
50 .compat_ioctl = ext2_compat_ioctl,
51#endif
49 .mmap = generic_file_mmap, 52 .mmap = generic_file_mmap,
50 .open = generic_file_open, 53 .open = generic_file_open,
51 .release = ext2_release_file, 54 .release = ext2_release_file,
@@ -63,6 +66,9 @@ const struct file_operations ext2_xip_file_operations = {
63 .read = xip_file_read, 66 .read = xip_file_read,
64 .write = xip_file_write, 67 .write = xip_file_write,
65 .ioctl = ext2_ioctl, 68 .ioctl = ext2_ioctl,
69#ifdef CONFIG_COMPAT
70 .compat_ioctl = ext2_compat_ioctl,
71#endif
66 .mmap = xip_file_mmap, 72 .mmap = xip_file_mmap,
67 .open = generic_file_open, 73 .open = generic_file_open,
68 .release = ext2_release_file, 74 .release = ext2_release_file,
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index 3ca9afdf713d..1dfba77eab10 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -11,6 +11,8 @@
11#include <linux/capability.h> 11#include <linux/capability.h>
12#include <linux/time.h> 12#include <linux/time.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/compat.h>
15#include <linux/smp_lock.h>
14#include <asm/current.h> 16#include <asm/current.h>
15#include <asm/uaccess.h> 17#include <asm/uaccess.h>
16 18
@@ -80,3 +82,33 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
80 return -ENOTTY; 82 return -ENOTTY;
81 } 83 }
82} 84}
85
86#ifdef CONFIG_COMPAT
87long ext2_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
88{
89 struct inode *inode = file->f_dentry->d_inode;
90 int ret;
91
92 /* These are just misnamed, they actually get/put from/to user an int */
93 switch (cmd) {
94 case EXT2_IOC32_GETFLAGS:
95 cmd = EXT2_IOC_GETFLAGS;
96 break;
97 case EXT2_IOC32_SETFLAGS:
98 cmd = EXT2_IOC_SETFLAGS;
99 break;
100 case EXT2_IOC32_GETVERSION:
101 cmd = EXT2_IOC_GETVERSION;
102 break;
103 case EXT2_IOC32_SETVERSION:
104 cmd = EXT2_IOC_SETVERSION;
105 break;
106 default:
107 return -ENOIOCTLCMD;
108 }
109 lock_kernel();
110 ret = ext2_ioctl(inode, file, cmd, (unsigned long) compat_ptr(arg));
111 unlock_kernel();
112 return ret;
113}
114#endif
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c
index 429acbb4e064..d0b54f30b914 100644
--- a/fs/ext3/dir.c
+++ b/fs/ext3/dir.c
@@ -44,6 +44,9 @@ const struct file_operations ext3_dir_operations = {
44 .read = generic_read_dir, 44 .read = generic_read_dir,
45 .readdir = ext3_readdir, /* we take BKL. needed?*/ 45 .readdir = ext3_readdir, /* we take BKL. needed?*/
46 .ioctl = ext3_ioctl, /* BKL held */ 46 .ioctl = ext3_ioctl, /* BKL held */
47#ifdef CONFIG_COMPAT
48 .compat_ioctl = ext3_compat_ioctl,
49#endif
47 .fsync = ext3_sync_file, /* BKL held */ 50 .fsync = ext3_sync_file, /* BKL held */
48#ifdef CONFIG_EXT3_INDEX 51#ifdef CONFIG_EXT3_INDEX
49 .release = ext3_release_dir, 52 .release = ext3_release_dir,
diff --git a/fs/ext3/file.c b/fs/ext3/file.c
index 994efd189f4e..74ff20f9d09b 100644
--- a/fs/ext3/file.c
+++ b/fs/ext3/file.c
@@ -114,6 +114,9 @@ const struct file_operations ext3_file_operations = {
114 .readv = generic_file_readv, 114 .readv = generic_file_readv,
115 .writev = generic_file_writev, 115 .writev = generic_file_writev,
116 .ioctl = ext3_ioctl, 116 .ioctl = ext3_ioctl,
117#ifdef CONFIG_COMPAT
118 .compat_ioctl = ext3_compat_ioctl,
119#endif
117 .mmap = generic_file_mmap, 120 .mmap = generic_file_mmap,
118 .open = generic_file_open, 121 .open = generic_file_open,
119 .release = ext3_release_file, 122 .release = ext3_release_file,
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index dcf4f1dd108b..03ba5bcab186 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -36,6 +36,7 @@
36#include <linux/writeback.h> 36#include <linux/writeback.h>
37#include <linux/mpage.h> 37#include <linux/mpage.h>
38#include <linux/uio.h> 38#include <linux/uio.h>
39#include <linux/bio.h>
39#include "xattr.h" 40#include "xattr.h"
40#include "acl.h" 41#include "acl.h"
41 42
@@ -1073,7 +1074,7 @@ struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode,
1073 return bh; 1074 return bh;
1074 if (buffer_uptodate(bh)) 1075 if (buffer_uptodate(bh))
1075 return bh; 1076 return bh;
1076 ll_rw_block(READ, 1, &bh); 1077 ll_rw_block(READ_META, 1, &bh);
1077 wait_on_buffer(bh); 1078 wait_on_buffer(bh);
1078 if (buffer_uptodate(bh)) 1079 if (buffer_uptodate(bh))
1079 return bh; 1080 return bh;
@@ -2540,7 +2541,7 @@ make_io:
2540 */ 2541 */
2541 get_bh(bh); 2542 get_bh(bh);
2542 bh->b_end_io = end_buffer_read_sync; 2543 bh->b_end_io = end_buffer_read_sync;
2543 submit_bh(READ, bh); 2544 submit_bh(READ_META, bh);
2544 wait_on_buffer(bh); 2545 wait_on_buffer(bh);
2545 if (!buffer_uptodate(bh)) { 2546 if (!buffer_uptodate(bh)) {
2546 ext3_error(inode->i_sb, "ext3_get_inode_loc", 2547 ext3_error(inode->i_sb, "ext3_get_inode_loc",
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c
index 3a6b012d120c..12daa6869572 100644
--- a/fs/ext3/ioctl.c
+++ b/fs/ext3/ioctl.c
@@ -13,9 +13,10 @@
13#include <linux/ext3_fs.h> 13#include <linux/ext3_fs.h>
14#include <linux/ext3_jbd.h> 14#include <linux/ext3_jbd.h>
15#include <linux/time.h> 15#include <linux/time.h>
16#include <linux/compat.h>
17#include <linux/smp_lock.h>
16#include <asm/uaccess.h> 18#include <asm/uaccess.h>
17 19
18
19int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, 20int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
20 unsigned long arg) 21 unsigned long arg)
21{ 22{
@@ -252,3 +253,55 @@ flags_err:
252 return -ENOTTY; 253 return -ENOTTY;
253 } 254 }
254} 255}
256
257#ifdef CONFIG_COMPAT
258long ext3_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
259{
260 struct inode *inode = file->f_dentry->d_inode;
261 int ret;
262
263 /* These are just misnamed, they actually get/put from/to user an int */
264 switch (cmd) {
265 case EXT3_IOC32_GETFLAGS:
266 cmd = EXT3_IOC_GETFLAGS;
267 break;
268 case EXT3_IOC32_SETFLAGS:
269 cmd = EXT3_IOC_SETFLAGS;
270 break;
271 case EXT3_IOC32_GETVERSION:
272 cmd = EXT3_IOC_GETVERSION;
273 break;
274 case EXT3_IOC32_SETVERSION:
275 cmd = EXT3_IOC_SETVERSION;
276 break;
277 case EXT3_IOC32_GROUP_EXTEND:
278 cmd = EXT3_IOC_GROUP_EXTEND;
279 break;
280 case EXT3_IOC32_GETVERSION_OLD:
281 cmd = EXT3_IOC_GETVERSION_OLD;
282 break;
283 case EXT3_IOC32_SETVERSION_OLD:
284 cmd = EXT3_IOC_SETVERSION_OLD;
285 break;
286#ifdef CONFIG_JBD_DEBUG
287 case EXT3_IOC32_WAIT_FOR_READONLY:
288 cmd = EXT3_IOC_WAIT_FOR_READONLY;
289 break;
290#endif
291 case EXT3_IOC32_GETRSVSZ:
292 cmd = EXT3_IOC_GETRSVSZ;
293 break;
294 case EXT3_IOC32_SETRSVSZ:
295 cmd = EXT3_IOC_SETRSVSZ;
296 break;
297 case EXT3_IOC_GROUP_ADD:
298 break;
299 default:
300 return -ENOIOCTLCMD;
301 }
302 lock_kernel();
303 ret = ext3_ioctl(inode, file, cmd, (unsigned long) compat_ptr(arg));
304 unlock_kernel();
305 return ret;
306}
307#endif
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 85d132c37ee0..235e77b52ea5 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -35,6 +35,7 @@
35#include <linux/string.h> 35#include <linux/string.h>
36#include <linux/quotaops.h> 36#include <linux/quotaops.h>
37#include <linux/buffer_head.h> 37#include <linux/buffer_head.h>
38#include <linux/bio.h>
38#include <linux/smp_lock.h> 39#include <linux/smp_lock.h>
39 40
40#include "namei.h" 41#include "namei.h"
@@ -870,7 +871,7 @@ restart:
870 bh = ext3_getblk(NULL, dir, b++, 0, &err); 871 bh = ext3_getblk(NULL, dir, b++, 0, &err);
871 bh_use[ra_max] = bh; 872 bh_use[ra_max] = bh;
872 if (bh) 873 if (bh)
873 ll_rw_block(READ, 1, &bh); 874 ll_rw_block(READ_META, 1, &bh);
874 } 875 }
875 } 876 }
876 if ((bh = bh_use[ra_ptr++]) == NULL) 877 if ((bh = bh_use[ra_ptr++]) == NULL)
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 698b85bb1dd4..3e50a4166283 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -20,6 +20,7 @@
20#include <linux/dirent.h> 20#include <linux/dirent.h>
21#include <linux/smp_lock.h> 21#include <linux/smp_lock.h>
22#include <linux/buffer_head.h> 22#include <linux/buffer_head.h>
23#include <linux/compat.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24 25
25static inline loff_t fat_make_i_pos(struct super_block *sb, 26static inline loff_t fat_make_i_pos(struct super_block *sb,
@@ -741,10 +742,65 @@ static int fat_dir_ioctl(struct inode * inode, struct file * filp,
741 return ret; 742 return ret;
742} 743}
743 744
745#ifdef CONFIG_COMPAT
746#define VFAT_IOCTL_READDIR_BOTH32 _IOR('r', 1, struct compat_dirent[2])
747#define VFAT_IOCTL_READDIR_SHORT32 _IOR('r', 2, struct compat_dirent[2])
748
749static long fat_compat_put_dirent32(struct dirent *d,
750 struct compat_dirent __user *d32)
751{
752 if (!access_ok(VERIFY_WRITE, d32, sizeof(struct compat_dirent)))
753 return -EFAULT;
754
755 __put_user(d->d_ino, &d32->d_ino);
756 __put_user(d->d_off, &d32->d_off);
757 __put_user(d->d_reclen, &d32->d_reclen);
758 if (__copy_to_user(d32->d_name, d->d_name, d->d_reclen))
759 return -EFAULT;
760
761 return 0;
762}
763
764static long fat_compat_dir_ioctl(struct file *file, unsigned cmd,
765 unsigned long arg)
766{
767 struct compat_dirent __user *p = compat_ptr(arg);
768 int ret;
769 mm_segment_t oldfs = get_fs();
770 struct dirent d[2];
771
772 switch (cmd) {
773 case VFAT_IOCTL_READDIR_BOTH32:
774 cmd = VFAT_IOCTL_READDIR_BOTH;
775 break;
776 case VFAT_IOCTL_READDIR_SHORT32:
777 cmd = VFAT_IOCTL_READDIR_SHORT;
778 break;
779 default:
780 return -ENOIOCTLCMD;
781 }
782
783 set_fs(KERNEL_DS);
784 lock_kernel();
785 ret = fat_dir_ioctl(file->f_dentry->d_inode, file,
786 cmd, (unsigned long) &d);
787 unlock_kernel();
788 set_fs(oldfs);
789 if (ret >= 0) {
790 ret |= fat_compat_put_dirent32(&d[0], p);
791 ret |= fat_compat_put_dirent32(&d[1], p + 1);
792 }
793 return ret;
794}
795#endif /* CONFIG_COMPAT */
796
744const struct file_operations fat_dir_operations = { 797const struct file_operations fat_dir_operations = {
745 .read = generic_read_dir, 798 .read = generic_read_dir,
746 .readdir = fat_readdir, 799 .readdir = fat_readdir,
747 .ioctl = fat_dir_ioctl, 800 .ioctl = fat_dir_ioctl,
801#ifdef CONFIG_COMPAT
802 .compat_ioctl = fat_compat_dir_ioctl,
803#endif
748 .fsync = file_fsync, 804 .fsync = file_fsync,
749}; 805};
750 806
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 892643dc9af1..c403b66ec83c 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -22,8 +22,7 @@
22#include <linux/blkdev.h> 22#include <linux/blkdev.h>
23#include <linux/backing-dev.h> 23#include <linux/backing-dev.h>
24#include <linux/buffer_head.h> 24#include <linux/buffer_head.h>
25 25#include "internal.h"
26extern struct super_block *blockdev_superblock;
27 26
28/** 27/**
29 * __mark_inode_dirty - internal function 28 * __mark_inode_dirty - internal function
@@ -320,7 +319,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
320 319
321 if (!bdi_cap_writeback_dirty(bdi)) { 320 if (!bdi_cap_writeback_dirty(bdi)) {
322 list_move(&inode->i_list, &sb->s_dirty); 321 list_move(&inode->i_list, &sb->s_dirty);
323 if (sb == blockdev_superblock) { 322 if (sb_is_blkdev_sb(sb)) {
324 /* 323 /*
325 * Dirty memory-backed blockdev: the ramdisk 324 * Dirty memory-backed blockdev: the ramdisk
326 * driver does this. Skip just this inode 325 * driver does this. Skip just this inode
@@ -337,14 +336,14 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
337 336
338 if (wbc->nonblocking && bdi_write_congested(bdi)) { 337 if (wbc->nonblocking && bdi_write_congested(bdi)) {
339 wbc->encountered_congestion = 1; 338 wbc->encountered_congestion = 1;
340 if (sb != blockdev_superblock) 339 if (!sb_is_blkdev_sb(sb))
341 break; /* Skip a congested fs */ 340 break; /* Skip a congested fs */
342 list_move(&inode->i_list, &sb->s_dirty); 341 list_move(&inode->i_list, &sb->s_dirty);
343 continue; /* Skip a congested blockdev */ 342 continue; /* Skip a congested blockdev */
344 } 343 }
345 344
346 if (wbc->bdi && bdi != wbc->bdi) { 345 if (wbc->bdi && bdi != wbc->bdi) {
347 if (sb != blockdev_superblock) 346 if (!sb_is_blkdev_sb(sb))
348 break; /* fs has the wrong queue */ 347 break; /* fs has the wrong queue */
349 list_move(&inode->i_list, &sb->s_dirty); 348 list_move(&inode->i_list, &sb->s_dirty);
350 continue; /* blockdev has wrong queue */ 349 continue; /* blockdev has wrong queue */
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 8a1ca5ef7ada..3915635b4470 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -246,12 +246,8 @@ struct hfsplus_readdir_data {
246 246
247/* ext2 ioctls (EXT2_IOC_GETFLAGS and EXT2_IOC_SETFLAGS) to support 247/* ext2 ioctls (EXT2_IOC_GETFLAGS and EXT2_IOC_SETFLAGS) to support
248 * chattr/lsattr */ 248 * chattr/lsattr */
249#define HFSPLUS_IOC_EXT2_GETFLAGS _IOR('f', 1, long) 249#define HFSPLUS_IOC_EXT2_GETFLAGS FS_IOC_GETFLAGS
250#define HFSPLUS_IOC_EXT2_SETFLAGS _IOW('f', 2, long) 250#define HFSPLUS_IOC_EXT2_SETFLAGS FS_IOC_SETFLAGS
251
252#define EXT2_FLAG_IMMUTABLE 0x00000010 /* Immutable file */
253#define EXT2_FLAG_APPEND 0x00000020 /* writes to file may only append */
254#define EXT2_FLAG_NODUMP 0x00000040 /* do not dump file */
255 251
256 252
257/* 253/*
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index 13cf848ac833..79fd10402ea3 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -28,11 +28,11 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
28 case HFSPLUS_IOC_EXT2_GETFLAGS: 28 case HFSPLUS_IOC_EXT2_GETFLAGS:
29 flags = 0; 29 flags = 0;
30 if (HFSPLUS_I(inode).rootflags & HFSPLUS_FLG_IMMUTABLE) 30 if (HFSPLUS_I(inode).rootflags & HFSPLUS_FLG_IMMUTABLE)
31 flags |= EXT2_FLAG_IMMUTABLE; /* EXT2_IMMUTABLE_FL */ 31 flags |= FS_IMMUTABLE_FL; /* EXT2_IMMUTABLE_FL */
32 if (HFSPLUS_I(inode).rootflags & HFSPLUS_FLG_APPEND) 32 if (HFSPLUS_I(inode).rootflags & HFSPLUS_FLG_APPEND)
33 flags |= EXT2_FLAG_APPEND; /* EXT2_APPEND_FL */ 33 flags |= FS_APPEND_FL; /* EXT2_APPEND_FL */
34 if (HFSPLUS_I(inode).userflags & HFSPLUS_FLG_NODUMP) 34 if (HFSPLUS_I(inode).userflags & HFSPLUS_FLG_NODUMP)
35 flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */ 35 flags |= FS_NODUMP_FL; /* EXT2_NODUMP_FL */
36 return put_user(flags, (int __user *)arg); 36 return put_user(flags, (int __user *)arg);
37 case HFSPLUS_IOC_EXT2_SETFLAGS: { 37 case HFSPLUS_IOC_EXT2_SETFLAGS: {
38 if (IS_RDONLY(inode)) 38 if (IS_RDONLY(inode))
@@ -44,32 +44,31 @@ int hfsplus_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
44 if (get_user(flags, (int __user *)arg)) 44 if (get_user(flags, (int __user *)arg))
45 return -EFAULT; 45 return -EFAULT;
46 46
47 if (flags & (EXT2_FLAG_IMMUTABLE|EXT2_FLAG_APPEND) || 47 if (flags & (FS_IMMUTABLE_FL|FS_APPEND_FL) ||
48 HFSPLUS_I(inode).rootflags & (HFSPLUS_FLG_IMMUTABLE|HFSPLUS_FLG_APPEND)) { 48 HFSPLUS_I(inode).rootflags & (HFSPLUS_FLG_IMMUTABLE|HFSPLUS_FLG_APPEND)) {
49 if (!capable(CAP_LINUX_IMMUTABLE)) 49 if (!capable(CAP_LINUX_IMMUTABLE))
50 return -EPERM; 50 return -EPERM;
51 } 51 }
52 52
53 /* don't silently ignore unsupported ext2 flags */ 53 /* don't silently ignore unsupported ext2 flags */
54 if (flags & ~(EXT2_FLAG_IMMUTABLE|EXT2_FLAG_APPEND| 54 if (flags & ~(FS_IMMUTABLE_FL|FS_APPEND_FL|FS_NODUMP_FL))
55 EXT2_FLAG_NODUMP))
56 return -EOPNOTSUPP; 55 return -EOPNOTSUPP;
57 56
58 if (flags & EXT2_FLAG_IMMUTABLE) { /* EXT2_IMMUTABLE_FL */ 57 if (flags & FS_IMMUTABLE_FL) { /* EXT2_IMMUTABLE_FL */
59 inode->i_flags |= S_IMMUTABLE; 58 inode->i_flags |= S_IMMUTABLE;
60 HFSPLUS_I(inode).rootflags |= HFSPLUS_FLG_IMMUTABLE; 59 HFSPLUS_I(inode).rootflags |= HFSPLUS_FLG_IMMUTABLE;
61 } else { 60 } else {
62 inode->i_flags &= ~S_IMMUTABLE; 61 inode->i_flags &= ~S_IMMUTABLE;
63 HFSPLUS_I(inode).rootflags &= ~HFSPLUS_FLG_IMMUTABLE; 62 HFSPLUS_I(inode).rootflags &= ~HFSPLUS_FLG_IMMUTABLE;
64 } 63 }
65 if (flags & EXT2_FLAG_APPEND) { /* EXT2_APPEND_FL */ 64 if (flags & FS_APPEND_FL) { /* EXT2_APPEND_FL */
66 inode->i_flags |= S_APPEND; 65 inode->i_flags |= S_APPEND;
67 HFSPLUS_I(inode).rootflags |= HFSPLUS_FLG_APPEND; 66 HFSPLUS_I(inode).rootflags |= HFSPLUS_FLG_APPEND;
68 } else { 67 } else {
69 inode->i_flags &= ~S_APPEND; 68 inode->i_flags &= ~S_APPEND;
70 HFSPLUS_I(inode).rootflags &= ~HFSPLUS_FLG_APPEND; 69 HFSPLUS_I(inode).rootflags &= ~HFSPLUS_FLG_APPEND;
71 } 70 }
72 if (flags & EXT2_FLAG_NODUMP) /* EXT2_NODUMP_FL */ 71 if (flags & FS_NODUMP_FL) /* EXT2_NODUMP_FL */
73 HFSPLUS_I(inode).userflags |= HFSPLUS_FLG_NODUMP; 72 HFSPLUS_I(inode).userflags |= HFSPLUS_FLG_NODUMP;
74 else 73 else
75 HFSPLUS_I(inode).userflags &= ~HFSPLUS_FLG_NODUMP; 74 HFSPLUS_I(inode).userflags &= ~HFSPLUS_FLG_NODUMP;
diff --git a/fs/inode.c b/fs/inode.c
index abf77471e6c4..ada7643104e1 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -362,27 +362,6 @@ int invalidate_inodes(struct super_block * sb)
362} 362}
363 363
364EXPORT_SYMBOL(invalidate_inodes); 364EXPORT_SYMBOL(invalidate_inodes);
365
366int __invalidate_device(struct block_device *bdev)
367{
368 struct super_block *sb = get_super(bdev);
369 int res = 0;
370
371 if (sb) {
372 /*
373 * no need to lock the super, get_super holds the
374 * read mutex so the filesystem cannot go away
375 * under us (->put_super runs with the write lock
376 * hold).
377 */
378 shrink_dcache_sb(sb);
379 res = invalidate_inodes(sb);
380 drop_super(sb);
381 }
382 invalidate_bdev(bdev, 0);
383 return res;
384}
385EXPORT_SYMBOL(__invalidate_device);
386 365
387static int can_unuse(struct inode *inode) 366static int can_unuse(struct inode *inode)
388{ 367{
diff --git a/fs/internal.h b/fs/internal.h
new file mode 100644
index 000000000000..ea00126c9a59
--- /dev/null
+++ b/fs/internal.h
@@ -0,0 +1,55 @@
1/* fs/ internal definitions
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/ioctl32.h>
13
14struct super_block;
15
16/*
17 * block_dev.c
18 */
19#ifdef CONFIG_BLOCK
20extern struct super_block *blockdev_superblock;
21extern void __init bdev_cache_init(void);
22
23static inline int sb_is_blkdev_sb(struct super_block *sb)
24{
25 return sb == blockdev_superblock;
26}
27
28#else
29static inline void bdev_cache_init(void)
30{
31}
32
33static inline int sb_is_blkdev_sb(struct super_block *sb)
34{
35 return 0;
36}
37#endif
38
39/*
40 * char_dev.c
41 */
42extern void __init chrdev_init(void);
43
44/*
45 * compat_ioctl.c
46 */
47#ifdef CONFIG_COMPAT
48extern struct ioctl_trans ioctl_start[];
49extern int ioctl_table_size;
50#endif
51
52/*
53 * namespace.c
54 */
55extern int copy_mount_options(const void __user *, unsigned long *);
diff --git a/fs/ioprio.c b/fs/ioprio.c
index 78b1deae3fa2..6dc6721d9e82 100644
--- a/fs/ioprio.c
+++ b/fs/ioprio.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fs/ioprio.c 2 * fs/ioprio.c
3 * 3 *
4 * Copyright (C) 2004 Jens Axboe <axboe@suse.de> 4 * Copyright (C) 2004 Jens Axboe <axboe@kernel.dk>
5 * 5 *
6 * Helper functions for setting/querying io priorities of processes. The 6 * Helper functions for setting/querying io priorities of processes. The
7 * system calls closely mimmick getpriority/setpriority, see the man page for 7 * system calls closely mimmick getpriority/setpriority, see the man page for
@@ -47,8 +47,8 @@ static int set_task_ioprio(struct task_struct *task, int ioprio)
47 /* see wmb() in current_io_context() */ 47 /* see wmb() in current_io_context() */
48 smp_read_barrier_depends(); 48 smp_read_barrier_depends();
49 49
50 if (ioc && ioc->set_ioprio) 50 if (ioc)
51 ioc->set_ioprio(ioc, ioprio); 51 ioc->ioprio_changed = 1;
52 52
53 task_unlock(task); 53 task_unlock(task);
54 return 0; 54 return 0;
@@ -81,7 +81,12 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
81 } 81 }
82 82
83 ret = -ESRCH; 83 ret = -ESRCH;
84 read_lock_irq(&tasklist_lock); 84 /*
85 * We want IOPRIO_WHO_PGRP/IOPRIO_WHO_USER to be "atomic",
86 * so we can't use rcu_read_lock(). See re-copy of ->ioprio
87 * in copy_process().
88 */
89 read_lock(&tasklist_lock);
85 switch (which) { 90 switch (which) {
86 case IOPRIO_WHO_PROCESS: 91 case IOPRIO_WHO_PROCESS:
87 if (!who) 92 if (!who)
@@ -124,7 +129,7 @@ free_uid:
124 ret = -EINVAL; 129 ret = -EINVAL;
125 } 130 }
126 131
127 read_unlock_irq(&tasklist_lock); 132 read_unlock(&tasklist_lock);
128 return ret; 133 return ret;
129} 134}
130 135
@@ -170,7 +175,7 @@ asmlinkage long sys_ioprio_get(int which, int who)
170 int ret = -ESRCH; 175 int ret = -ESRCH;
171 int tmpio; 176 int tmpio;
172 177
173 read_lock_irq(&tasklist_lock); 178 read_lock(&tasklist_lock);
174 switch (which) { 179 switch (which) {
175 case IOPRIO_WHO_PROCESS: 180 case IOPRIO_WHO_PROCESS:
176 if (!who) 181 if (!who)
@@ -221,7 +226,7 @@ asmlinkage long sys_ioprio_get(int which, int who)
221 ret = -EINVAL; 226 ret = -EINVAL;
222 } 227 }
223 228
224 read_unlock_irq(&tasklist_lock); 229 read_unlock(&tasklist_lock);
225 return ret; 230 return ret;
226} 231}
227 232
diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c
index 67b3774820eb..37db52488262 100644
--- a/fs/jfs/ioctl.c
+++ b/fs/jfs/ioctl.c
@@ -6,7 +6,6 @@
6 */ 6 */
7 7
8#include <linux/fs.h> 8#include <linux/fs.h>
9#include <linux/ext2_fs.h>
10#include <linux/ctype.h> 9#include <linux/ctype.h>
11#include <linux/capability.h> 10#include <linux/capability.h>
12#include <linux/time.h> 11#include <linux/time.h>
@@ -22,13 +21,13 @@ static struct {
22 long jfs_flag; 21 long jfs_flag;
23 long ext2_flag; 22 long ext2_flag;
24} jfs_map[] = { 23} jfs_map[] = {
25 {JFS_NOATIME_FL, EXT2_NOATIME_FL}, 24 {JFS_NOATIME_FL, FS_NOATIME_FL},
26 {JFS_DIRSYNC_FL, EXT2_DIRSYNC_FL}, 25 {JFS_DIRSYNC_FL, FS_DIRSYNC_FL},
27 {JFS_SYNC_FL, EXT2_SYNC_FL}, 26 {JFS_SYNC_FL, FS_SYNC_FL},
28 {JFS_SECRM_FL, EXT2_SECRM_FL}, 27 {JFS_SECRM_FL, FS_SECRM_FL},
29 {JFS_UNRM_FL, EXT2_UNRM_FL}, 28 {JFS_UNRM_FL, FS_UNRM_FL},
30 {JFS_APPEND_FL, EXT2_APPEND_FL}, 29 {JFS_APPEND_FL, FS_APPEND_FL},
31 {JFS_IMMUTABLE_FL, EXT2_IMMUTABLE_FL}, 30 {JFS_IMMUTABLE_FL, FS_IMMUTABLE_FL},
32 {0, 0}, 31 {0, 0},
33}; 32};
34 33
diff --git a/fs/mpage.c b/fs/mpage.c
index 1e4598247d0b..692a3e578fc8 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -693,6 +693,8 @@ out:
693 * the call was made get new I/O started against them. If wbc->sync_mode is 693 * the call was made get new I/O started against them. If wbc->sync_mode is
694 * WB_SYNC_ALL then we were called for data integrity and we must wait for 694 * WB_SYNC_ALL then we were called for data integrity and we must wait for
695 * existing IO to complete. 695 * existing IO to complete.
696 *
697 * If you fix this you should check generic_writepages() also!
696 */ 698 */
697int 699int
698mpage_writepages(struct address_space *mapping, 700mpage_writepages(struct address_space *mapping,
diff --git a/fs/namespace.c b/fs/namespace.c
index 6ede3a539ed8..66d921e14fee 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -24,12 +24,11 @@
24#include <linux/namei.h> 24#include <linux/namei.h>
25#include <linux/security.h> 25#include <linux/security.h>
26#include <linux/mount.h> 26#include <linux/mount.h>
27#include <linux/ramfs.h>
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28#include <asm/unistd.h> 29#include <asm/unistd.h>
29#include "pnode.h" 30#include "pnode.h"
30 31
31extern int __init init_rootfs(void);
32
33/* spinlock for vfsmount related operations, inplace of dcache_lock */ 32/* spinlock for vfsmount related operations, inplace of dcache_lock */
34__cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock); 33__cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock);
35 34
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b674462793d3..f6675d2c386c 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -51,7 +51,6 @@
51#include <linux/mm.h> 51#include <linux/mm.h>
52#include <linux/pagemap.h> 52#include <linux/pagemap.h>
53#include <linux/file.h> 53#include <linux/file.h>
54#include <linux/mpage.h>
55#include <linux/writeback.h> 54#include <linux/writeback.h>
56 55
57#include <linux/sunrpc/clnt.h> 56#include <linux/sunrpc/clnt.h>
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/reiserfs/dir.c b/fs/reiserfs/dir.c
index 9aabcc0ccd2d..657050ad7430 100644
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -22,6 +22,9 @@ const struct file_operations reiserfs_dir_operations = {
22 .readdir = reiserfs_readdir, 22 .readdir = reiserfs_readdir,
23 .fsync = reiserfs_dir_fsync, 23 .fsync = reiserfs_dir_fsync,
24 .ioctl = reiserfs_ioctl, 24 .ioctl = reiserfs_ioctl,
25#ifdef CONFIG_COMPAT
26 .compat_ioctl = reiserfs_compat_ioctl,
27#endif
25}; 28};
26 29
27static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, 30static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 1cfbe857ba27..3e08f7161a3d 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -2,6 +2,7 @@
2 * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README 2 * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
3 */ 3 */
4 4
5#include <linux/config.h>
5#include <linux/time.h> 6#include <linux/time.h>
6#include <linux/reiserfs_fs.h> 7#include <linux/reiserfs_fs.h>
7#include <linux/reiserfs_acl.h> 8#include <linux/reiserfs_acl.h>
@@ -1568,6 +1569,9 @@ const struct file_operations reiserfs_file_operations = {
1568 .read = generic_file_read, 1569 .read = generic_file_read,
1569 .write = reiserfs_file_write, 1570 .write = reiserfs_file_write,
1570 .ioctl = reiserfs_ioctl, 1571 .ioctl = reiserfs_ioctl,
1572#ifdef CONFIG_COMPAT
1573 .compat_ioctl = reiserfs_compat_ioctl,
1574#endif
1571 .mmap = generic_file_mmap, 1575 .mmap = generic_file_mmap,
1572 .release = reiserfs_file_release, 1576 .release = reiserfs_file_release,
1573 .fsync = reiserfs_sync_file, 1577 .fsync = reiserfs_sync_file,
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index a986b5e1e288..9c57578cb831 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -9,6 +9,7 @@
9#include <asm/uaccess.h> 9#include <asm/uaccess.h>
10#include <linux/pagemap.h> 10#include <linux/pagemap.h>
11#include <linux/smp_lock.h> 11#include <linux/smp_lock.h>
12#include <linux/compat.h>
12 13
13static int reiserfs_unpack(struct inode *inode, struct file *filp); 14static int reiserfs_unpack(struct inode *inode, struct file *filp);
14 15
@@ -94,6 +95,40 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
94 } 95 }
95} 96}
96 97
98#ifdef CONFIG_COMPAT
99long reiserfs_compat_ioctl(struct file *file, unsigned int cmd,
100 unsigned long arg)
101{
102 struct inode *inode = file->f_dentry->d_inode;
103 int ret;
104
105 /* These are just misnamed, they actually get/put from/to user an int */
106 switch (cmd) {
107 case REISERFS_IOC32_UNPACK:
108 cmd = REISERFS_IOC_UNPACK;
109 break;
110 case REISERFS_IOC32_GETFLAGS:
111 cmd = REISERFS_IOC_GETFLAGS;
112 break;
113 case REISERFS_IOC32_SETFLAGS:
114 cmd = REISERFS_IOC_SETFLAGS;
115 break;
116 case REISERFS_IOC32_GETVERSION:
117 cmd = REISERFS_IOC_GETVERSION;
118 break;
119 case REISERFS_IOC32_SETVERSION:
120 cmd = REISERFS_IOC_SETVERSION;
121 break;
122 default:
123 return -ENOIOCTLCMD;
124 }
125 lock_kernel();
126 ret = reiserfs_ioctl(inode, file, cmd, (unsigned long) compat_ptr(arg));
127 unlock_kernel();
128 return ret;
129}
130#endif
131
97/* 132/*
98** reiserfs_unpack 133** reiserfs_unpack
99** Function try to convert tail from direct item into indirect. 134** Function try to convert tail from direct item into indirect.
diff --git a/fs/splice.c b/fs/splice.c
index 684bca3d3a10..13e92dd19fbb 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -12,7 +12,7 @@
12 * Jens to support splicing to files, network, direct splicing, etc and 12 * Jens to support splicing to files, network, direct splicing, etc and
13 * fixing lots of bugs. 13 * fixing lots of bugs.
14 * 14 *
15 * Copyright (C) 2005-2006 Jens Axboe <axboe@suse.de> 15 * Copyright (C) 2005-2006 Jens Axboe <axboe@kernel.dk>
16 * Copyright (C) 2005-2006 Linus Torvalds <torvalds@osdl.org> 16 * Copyright (C) 2005-2006 Linus Torvalds <torvalds@osdl.org>
17 * Copyright (C) 2006 Ingo Molnar <mingo@elte.hu> 17 * Copyright (C) 2006 Ingo Molnar <mingo@elte.hu>
18 * 18 *
diff --git a/fs/super.c b/fs/super.c
index 6987824d0dce..aec99ddbe53f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -220,6 +220,37 @@ static int grab_super(struct super_block *s) __releases(sb_lock)
220 return 0; 220 return 0;
221} 221}
222 222
223/*
224 * Write out and wait upon all dirty data associated with this
225 * superblock. Filesystem data as well as the underlying block
226 * device. Takes the superblock lock. Requires a second blkdev
227 * flush by the caller to complete the operation.
228 */
229void __fsync_super(struct super_block *sb)
230{
231 sync_inodes_sb(sb, 0);
232 DQUOT_SYNC(sb);
233 lock_super(sb);
234 if (sb->s_dirt && sb->s_op->write_super)
235 sb->s_op->write_super(sb);
236 unlock_super(sb);
237 if (sb->s_op->sync_fs)
238 sb->s_op->sync_fs(sb, 1);
239 sync_blockdev(sb->s_bdev);
240 sync_inodes_sb(sb, 1);
241}
242
243/*
244 * Write out and wait upon all dirty data associated with this
245 * superblock. Filesystem data as well as the underlying block
246 * device. Takes the superblock lock.
247 */
248int fsync_super(struct super_block *sb)
249{
250 __fsync_super(sb);
251 return sync_blockdev(sb->s_bdev);
252}
253
223/** 254/**
224 * generic_shutdown_super - common helper for ->kill_sb() 255 * generic_shutdown_super - common helper for ->kill_sb()
225 * @sb: superblock to kill 256 * @sb: superblock to kill
@@ -540,8 +571,10 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
540{ 571{
541 int retval; 572 int retval;
542 573
574#ifdef CONFIG_BLOCK
543 if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev)) 575 if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev))
544 return -EACCES; 576 return -EACCES;
577#endif
545 if (flags & MS_RDONLY) 578 if (flags & MS_RDONLY)
546 acct_auto_close(sb); 579 acct_auto_close(sb);
547 shrink_dcache_sb(sb); 580 shrink_dcache_sb(sb);
@@ -661,6 +694,7 @@ void kill_litter_super(struct super_block *sb)
661 694
662EXPORT_SYMBOL(kill_litter_super); 695EXPORT_SYMBOL(kill_litter_super);
663 696
697#ifdef CONFIG_BLOCK
664static int set_bdev_super(struct super_block *s, void *data) 698static int set_bdev_super(struct super_block *s, void *data)
665{ 699{
666 s->s_bdev = data; 700 s->s_bdev = data;
@@ -756,6 +790,7 @@ void kill_block_super(struct super_block *sb)
756} 790}
757 791
758EXPORT_SYMBOL(kill_block_super); 792EXPORT_SYMBOL(kill_block_super);
793#endif
759 794
760int get_sb_nodev(struct file_system_type *fs_type, 795int get_sb_nodev(struct file_system_type *fs_type,
761 int flags, void *data, 796 int flags, void *data,
diff --git a/fs/sync.c b/fs/sync.c
index 955aef04da28..1de747b5ddb9 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -10,11 +10,124 @@
10#include <linux/syscalls.h> 10#include <linux/syscalls.h>
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <linux/pagemap.h> 12#include <linux/pagemap.h>
13#include <linux/quotaops.h>
14#include <linux/buffer_head.h>
13 15
14#define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ 16#define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \
15 SYNC_FILE_RANGE_WAIT_AFTER) 17 SYNC_FILE_RANGE_WAIT_AFTER)
16 18
17/* 19/*
20 * sync everything. Start out by waking pdflush, because that writes back
21 * all queues in parallel.
22 */
23static void do_sync(unsigned long wait)
24{
25 wakeup_pdflush(0);
26 sync_inodes(0); /* All mappings, inodes and their blockdevs */
27 DQUOT_SYNC(NULL);
28 sync_supers(); /* Write the superblocks */
29 sync_filesystems(0); /* Start syncing the filesystems */
30 sync_filesystems(wait); /* Waitingly sync the filesystems */
31 sync_inodes(wait); /* Mappings, inodes and blockdevs, again. */
32 if (!wait)
33 printk("Emergency Sync complete\n");
34 if (unlikely(laptop_mode))
35 laptop_sync_completion();
36}
37
38asmlinkage long sys_sync(void)
39{
40 do_sync(1);
41 return 0;
42}
43
44void emergency_sync(void)
45{
46 pdflush_operation(do_sync, 0);
47}
48
49/*
50 * Generic function to fsync a file.
51 *
52 * filp may be NULL if called via the msync of a vma.
53 */
54int file_fsync(struct file *filp, struct dentry *dentry, int datasync)
55{
56 struct inode * inode = dentry->d_inode;
57 struct super_block * sb;
58 int ret, err;
59
60 /* sync the inode to buffers */
61 ret = write_inode_now(inode, 0);
62
63 /* sync the superblock to buffers */
64 sb = inode->i_sb;
65 lock_super(sb);
66 if (sb->s_op->write_super)
67 sb->s_op->write_super(sb);
68 unlock_super(sb);
69
70 /* .. finally sync the buffers to disk */
71 err = sync_blockdev(sb->s_bdev);
72 if (!ret)
73 ret = err;
74 return ret;
75}
76
77long do_fsync(struct file *file, int datasync)
78{
79 int ret;
80 int err;
81 struct address_space *mapping = file->f_mapping;
82
83 if (!file->f_op || !file->f_op->fsync) {
84 /* Why? We can still call filemap_fdatawrite */
85 ret = -EINVAL;
86 goto out;
87 }
88
89 ret = filemap_fdatawrite(mapping);
90
91 /*
92 * We need to protect against concurrent writers, which could cause
93 * livelocks in fsync_buffers_list().
94 */
95 mutex_lock(&mapping->host->i_mutex);
96 err = file->f_op->fsync(file, file->f_dentry, datasync);
97 if (!ret)
98 ret = err;
99 mutex_unlock(&mapping->host->i_mutex);
100 err = filemap_fdatawait(mapping);
101 if (!ret)
102 ret = err;
103out:
104 return ret;
105}
106
107static long __do_fsync(unsigned int fd, int datasync)
108{
109 struct file *file;
110 int ret = -EBADF;
111
112 file = fget(fd);
113 if (file) {
114 ret = do_fsync(file, datasync);
115 fput(file);
116 }
117 return ret;
118}
119
120asmlinkage long sys_fsync(unsigned int fd)
121{
122 return __do_fsync(fd, 0);
123}
124
125asmlinkage long sys_fdatasync(unsigned int fd)
126{
127 return __do_fsync(fd, 1);
128}
129
130/*
18 * sys_sync_file_range() permits finely controlled syncing over a segment of 131 * sys_sync_file_range() permits finely controlled syncing over a segment of
19 * a file in the range offset .. (offset+nbytes-1) inclusive. If nbytes is 132 * a file in the range offset .. (offset+nbytes-1) inclusive. If nbytes is
20 * zero then sys_sync_file_range() will operate from offset out to EOF. 133 * zero then sys_sync_file_range() will operate from offset out to EOF.
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