diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/drivers/block/Kconfig linux-2.6.1-rc1-tiny1.config-block/drivers/block/Kconfig --- linux-2.6.1-rc1-tiny1.compile-fixes/drivers/block/Kconfig Wed Dec 17 19:58:28 2003 +++ linux-2.6.1-rc1-tiny1.config-block/drivers/block/Kconfig Thu Jan 8 11:29:14 2004 @@ -3,6 +3,7 @@ # menu "Block devices" + depends BLOCK config BLK_DEV_FD tristate "Normal floppy disk support" diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/drivers/block/Kconfig.embedded linux-2.6.1-rc1-tiny1.config-block/drivers/block/Kconfig.embedded --- linux-2.6.1-rc1-tiny1.compile-fixes/drivers/block/Kconfig.embedded Wed Dec 31 17:00:00 1969 +++ linux-2.6.1-rc1-tiny1.config-block/drivers/block/Kconfig.embedded Thu Jan 8 11:29:14 2004 @@ -0,0 +1,5 @@ +config BLOCK + bool "Block device support" if EMBEDDED + default y + help + Allow the complete removal of block device code diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/drivers/block/Kconfig.iosched linux-2.6.1-rc1-tiny1.config-block/drivers/block/Kconfig.iosched --- linux-2.6.1-rc1-tiny1.compile-fixes/drivers/block/Kconfig.iosched Wed Dec 17 19:58:07 2003 +++ linux-2.6.1-rc1-tiny1.config-block/drivers/block/Kconfig.iosched Thu Jan 8 11:29:14 2004 @@ -1,3 +1,5 @@ +if BLOCK + config IOSCHED_NOOP bool "No-op I/O scheduler" if EMBEDDED default y @@ -26,4 +28,6 @@ workloads, better. In the case of a single process performing I/O to a disk at any one time, its behaviour is almost identical to the anticipatory I/O scheduler and so is a good choice. + +endif diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/drivers/block/Makefile linux-2.6.1-rc1-tiny1.config-block/drivers/block/Makefile --- linux-2.6.1-rc1-tiny1.compile-fixes/drivers/block/Makefile Wed Dec 17 19:59:19 2003 +++ linux-2.6.1-rc1-tiny1.config-block/drivers/block/Makefile Thu Jan 8 11:29:14 2004 @@ -13,7 +13,7 @@ # kblockd threads # -obj-y := elevator.o ll_rw_blk.o ioctl.o genhd.o scsi_ioctl.o +obj-$(CONFIG_BLOCK) := elevator.o ll_rw_blk.o ioctl.o genhd.o scsi_ioctl.o obj-$(CONFIG_IOSCHED_NOOP) += noop-iosched.o obj-$(CONFIG_IOSCHED_AS) += as-iosched.o diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/drivers/md/Kconfig linux-2.6.1-rc1-tiny1.config-block/drivers/md/Kconfig --- linux-2.6.1-rc1-tiny1.compile-fixes/drivers/md/Kconfig Sat Jan 3 22:09:07 2004 +++ linux-2.6.1-rc1-tiny1.config-block/drivers/md/Kconfig Thu Jan 8 11:29:14 2004 @@ -3,6 +3,7 @@ # menu "Multi-device support (RAID and LVM)" + depends on BLOCK config MD bool "Multiple devices driver support (RAID and LVM)" diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/Kconfig linux-2.6.1-rc1-tiny1.config-block/fs/Kconfig --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/Kconfig Sun Jan 4 00:03:56 2004 +++ linux-2.6.1-rc1-tiny1.config-block/fs/Kconfig Thu Jan 8 11:29:14 2004 @@ -6,6 +6,7 @@ config EXT2_FS tristate "Second extended fs support" + depends on BLOCK help This is the de facto standard Linux file system (method to organize files on a storage device) for hard disks. @@ -85,6 +86,7 @@ config EXT3_FS tristate "Ext3 journalling file system support" + depends on BLOCK help This is the journaling version of the Second extended file system (often called ext3), the de facto standard Linux file system @@ -157,6 +159,7 @@ # dep_tristate ' Journal Block Device support (JBD for ext3)' CONFIG_JBD $CONFIG_EXT3_FS tristate default EXT3_FS + depends on BLOCK help This is a generic journaling layer for block devices. It is currently used by the ext3 file system, but it could also be used to @@ -195,6 +198,7 @@ config REISERFS_FS tristate "Reiserfs support" + depends on BLOCK help Stores not just filenames but the files themselves in a balanced tree. Uses journaling. @@ -246,6 +250,7 @@ config JFS_FS tristate "JFS filesystem support" + depends on BLOCK select NLS help This is a port of IBM's Journaled Filesystem . More information is @@ -293,6 +298,7 @@ config XFS_FS tristate "XFS filesystem support" + depends on BLOCK help XFS is a high performance journaling filesystem which originated on the SGI IRIX platform. It is completely multi-threaded, can @@ -358,6 +364,7 @@ config MINIX_FS tristate "Minix fs support" + depends on BLOCK help Minix is a simple operating system used in many classes about OS's. The minix file system (method to organize files on a hard disk @@ -375,6 +382,7 @@ config ROMFS_FS tristate "ROM file system support" + depends on BLOCK ---help--- This is a very small read-only file system mainly intended for initial ram disks of installation disks, but it could be used for @@ -466,6 +474,8 @@ N here. menu "CD-ROM/DVD Filesystems" + depends on BLOCK + config ISO9660_FS tristate "ISO 9660 CDROM file system support" @@ -529,6 +539,7 @@ endmenu menu "DOS/FAT/NT Filesystems" + depends on BLOCK config FAT_FS tristate "DOS FAT fs support" @@ -900,6 +911,7 @@ config ADFS_FS tristate "ADFS file system support (EXPERIMENTAL)" depends on EXPERIMENTAL + depends on BLOCK help The Acorn Disc Filing System is the standard file system of the RiscOS operating system which runs on Acorn's ARM-based Risc PC @@ -928,6 +940,7 @@ config AFFS_FS tristate "Amiga FFS file system support (EXPERIMENTAL)" depends on EXPERIMENTAL + depends on BLOCK help The Fast File System (FFS) is the common file system used on hard disks by Amiga(tm) systems since AmigaOS Version 1.3 (34.20). Say Y @@ -950,6 +963,7 @@ config HFS_FS tristate "Apple Macintosh file system support (EXPERIMENTAL)" depends on EXPERIMENTAL + depends on BLOCK help If you say Y here, you will be able to mount Macintosh-formatted floppy disks and hard drive partitions with full read-write access. @@ -962,6 +976,7 @@ config BEFS_FS tristate "BeOS file systemv(BeFS) support (read only) (EXPERIMENTAL)" depends on EXPERIMENTAL + depends on BLOCK select NLS help The BeOS File System (BeFS) is the native file system of Be, Inc's @@ -989,6 +1004,7 @@ config BFS_FS tristate "BFS file system support (EXPERIMENTAL)" depends on EXPERIMENTAL + depends on BLOCK help Boot File System (BFS) is a file system used under SCO UnixWare to allow the bootloader access to the kernel image and other important @@ -1011,6 +1027,7 @@ config EFS_FS tristate "EFS file system support (read only) (EXPERIMENTAL)" depends on EXPERIMENTAL + depends on BLOCK help EFS is an older file system used for non-ISO9660 CD-ROMs and hard disk partitions by SGI's IRIX operating system (IRIX 6.0 and newer @@ -1097,6 +1114,7 @@ config CRAMFS tristate "Compressed ROM file system support" + depends on BLOCK select ZLIB_INFLATE help Saying Y here includes support for CramFs (Compressed ROM File @@ -1116,6 +1134,7 @@ config VXFS_FS tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)" + depends on BLOCK help FreeVxFS is a file system driver that support the VERITAS VxFS(TM) file system format. VERITAS VxFS(TM) is the standard file system @@ -1133,6 +1152,7 @@ config HPFS_FS tristate "OS/2 HPFS file system support" + depends on BLOCK help OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS is the file system used for organizing files on OS/2 hard disk @@ -1149,6 +1169,7 @@ config QNX4FS_FS tristate "QNX4 file system support (read only)" + depends on BLOCK help This is the file system used by the real-time operating systems QNX 4 and QNX 6 (the latter is also called QNX RTP). @@ -1176,6 +1197,7 @@ config SYSV_FS tristate "System V/Xenix/V7/Coherent file system support" + depends on BLOCK help SCO, Xenix and Coherent are commercial Unix systems for Intel machines, and Version 7 was used on the DEC PDP-11. Saying Y @@ -1214,6 +1236,7 @@ config UFS_FS tristate "UFS file system support (read only)" + depends on BLOCK help BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD, OpenBSD and NeXTstep) use a file system called UFS. Some System V @@ -1608,6 +1631,7 @@ endmenu menu "Partition Types" + depends on BLOCK source "fs/partitions/Kconfig" diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/Makefile linux-2.6.1-rc1-tiny1.config-block/fs/Makefile --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/Makefile Sun Jan 4 00:03:56 2004 +++ linux-2.6.1-rc1-tiny1.config-block/fs/Makefile Thu Jan 8 11:29:14 2004 @@ -5,13 +5,14 @@ # Rewritten to use lists instead of if-statements. # -obj-y := open.o read_write.o file_table.o buffer.o \ - bio.o super.o block_dev.o char_dev.o stat.o exec.o pipe.o \ +obj-y := open.o read_write.o file_table.o \ + super.o char_dev.o stat.o exec.o pipe.o \ namei.o fcntl.o ioctl.o readdir.o select.o fifo.o locks.o \ dcache.o inode.o attr.o bad_inode.o file.o \ filesystems.o namespace.o seq_file.o xattr.o libfs.o \ - fs-writeback.o mpage.o direct-io.o aio.o + fs-writeback.o mpage.o aio.o sync.o +obj-$(CONFIG_BLOCK) += buffer.o bio.o block_dev.o direct-io.o obj-$(CONFIG_DNOTIFY) += dnotify.o obj-$(CONFIG_EPOLL) += eventpoll.o obj-$(CONFIG_COMPAT) += compat.o diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/block_dev.c linux-2.6.1-rc1-tiny1.config-block/fs/block_dev.c --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/block_dev.c Wed Dec 17 20:00:01 2003 +++ linux-2.6.1-rc1-tiny1.config-block/fs/block_dev.c Thu Jan 8 11:29:14 2004 @@ -899,3 +899,104 @@ } EXPORT_SYMBOL(close_bdev_excl); + +static void do_emergency_remount(unsigned long foo) +{ + struct super_block *sb; + + spin_lock(&sb_lock); + list_for_each_entry(sb, &super_blocks, s_list) { + sb->s_count++; + spin_unlock(&sb_lock); + down_read(&sb->s_umount); + if (sb->s_root && sb->s_bdev && !(sb->s_flags & MS_RDONLY)) { + /* + * ->remount_fs needs lock_kernel(). + * + * What lock protects sb->s_flags?? + */ + lock_kernel(); + do_remount_sb(sb, MS_RDONLY, NULL, 1); + unlock_kernel(); + } + drop_super(sb); + spin_lock(&sb_lock); + } + spin_unlock(&sb_lock); + printk("Emergency Remount complete\n"); +} + +void emergency_remount(void) +{ + pdflush_operation(do_emergency_remount, 0); +} + +static int set_bdev_super(struct super_block *s, void *data) +{ + s->s_bdev = data; + s->s_dev = s->s_bdev->bd_dev; + return 0; +} + +static int test_bdev_super(struct super_block *s, void *data) +{ + return (void *)s->s_bdev == data; +} + +struct super_block *get_sb_bdev(struct file_system_type *fs_type, + int flags, const char *dev_name, void *data, + int (*fill_super)(struct super_block *, void *, int)) +{ + struct block_device *bdev; + struct super_block *s; + int error = 0; + + bdev = open_bdev_excl(dev_name, flags, BDEV_FS, fs_type); + if (IS_ERR(bdev)) + return (struct super_block *)bdev; + + s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); + if (IS_ERR(s)) + goto out; + + if (s->s_root) { + if ((flags ^ s->s_flags) & MS_RDONLY) { + up_write(&s->s_umount); + deactivate_super(s); + s = ERR_PTR(-EBUSY); + } + goto out; + } else { + char b[BDEVNAME_SIZE]; + + s->s_flags = flags; + strncpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); + s->s_old_blocksize = block_size(bdev); + sb_set_blocksize(s, s->s_old_blocksize); + error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0); + if (error) { + up_write(&s->s_umount); + deactivate_super(s); + s = ERR_PTR(error); + } else + s->s_flags |= MS_ACTIVE; + } + + return s; + +out: + close_bdev_excl(bdev, BDEV_FS); + return s; +} + +EXPORT_SYMBOL(get_sb_bdev); + +void kill_block_super(struct super_block *sb) +{ + struct block_device *bdev = sb->s_bdev; + generic_shutdown_super(sb); + set_blocksize(bdev, sb->s_old_blocksize); + close_bdev_excl(bdev, BDEV_FS); +} + +EXPORT_SYMBOL(kill_block_super); diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/buffer.c linux-2.6.1-rc1-tiny1.config-block/fs/buffer.c --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/buffer.c Sun Jan 4 00:03:56 2004 +++ linux-2.6.1-rc1-tiny1.config-block/fs/buffer.c Thu Jan 8 11:29:14 2004 @@ -16,6 +16,10 @@ * Added 32k buffer block sizes - these are required older ARM systems. - RMK * * async buffer flushing, 1999 Andrea Arcangeli + * + * moved bdflush and generic sync functions to sync.c + * moved try_to_release_page to mm/page-writeback.c + * Eric Biederman 8 Jan 2004 */ #include @@ -225,27 +229,6 @@ /* * Write out and wait upon all dirty data associated with this - * superblock. Filesystem data as well as the underlying block - * device. Takes the superblock lock. - */ -int fsync_super(struct super_block *sb) -{ - sync_inodes_sb(sb, 0); - DQUOT_SYNC(sb); - lock_super(sb); - if (sb->s_dirt && sb->s_op->write_super) - sb->s_op->write_super(sb); - unlock_super(sb); - if (sb->s_op->sync_fs) - sb->s_op->sync_fs(sb, 1); - sync_blockdev(sb->s_bdev); - sync_inodes_sb(sb, 1); - - return sync_blockdev(sb->s_bdev); -} - -/* - * Write out and wait upon all dirty data associated with this * device. Filesystem data as well as the underlying block * device. Takes the superblock lock. */ @@ -260,137 +243,7 @@ return sync_blockdev(bdev); } -/* - * sync everything. Start out by waking pdflush, because that writes back - * all queues in parallel. - */ -static void do_sync(unsigned long wait) -{ - wakeup_bdflush(0); - sync_inodes(0); /* All mappings, inodes and their blockdevs */ - DQUOT_SYNC(NULL); - sync_supers(); /* Write the superblocks */ - sync_filesystems(0); /* Start syncing the filesystems */ - sync_filesystems(wait); /* Waitingly sync the filesystems */ - sync_inodes(wait); /* Mappings, inodes and blockdevs, again. */ - if (!wait) - printk("Emergency Sync complete\n"); -} - -asmlinkage long sys_sync(void) -{ - do_sync(1); - return 0; -} - -void emergency_sync(void) -{ - pdflush_operation(do_sync, 0); -} - -/* - * Generic function to fsync a file. - * - * filp may be NULL if called via the msync of a vma. - */ - -int file_fsync(struct file *filp, struct dentry *dentry, int datasync) -{ - struct inode * inode = dentry->d_inode; - struct super_block * sb; - int ret; - - /* sync the inode to buffers */ - write_inode_now(inode, 0); - - /* sync the superblock to buffers */ - sb = inode->i_sb; - lock_super(sb); - if (sb->s_op->write_super) - sb->s_op->write_super(sb); - unlock_super(sb); - - /* .. finally sync the buffers to disk */ - ret = sync_blockdev(sb->s_bdev); - return ret; -} - -asmlinkage long sys_fsync(unsigned int fd) -{ - struct file * file; - struct dentry * dentry; - struct inode * inode; - int ret, err; - - ret = -EBADF; - file = fget(fd); - if (!file) - goto out; - - dentry = file->f_dentry; - inode = dentry->d_inode; - - ret = -EINVAL; - if (!file->f_op || !file->f_op->fsync) { - /* Why? We can still call filemap_fdatawrite */ - goto out_putf; - } - - /* We need to protect against concurrent writers.. */ - down(&inode->i_sem); - current->flags |= PF_SYNCWRITE; - ret = filemap_fdatawrite(inode->i_mapping); - err = file->f_op->fsync(file, dentry, 0); - if (!ret) - ret = err; - err = filemap_fdatawait(inode->i_mapping); - if (!ret) - ret = err; - current->flags &= ~PF_SYNCWRITE; - up(&inode->i_sem); - -out_putf: - fput(file); -out: - return ret; -} - -asmlinkage long sys_fdatasync(unsigned int fd) -{ - struct file * file; - struct dentry * dentry; - struct inode * inode; - int ret, err; - - ret = -EBADF; - file = fget(fd); - if (!file) - goto out; - - dentry = file->f_dentry; - inode = dentry->d_inode; - - ret = -EINVAL; - if (!file->f_op || !file->f_op->fsync) - goto out_putf; - - down(&inode->i_sem); - current->flags |= PF_SYNCWRITE; - ret = filemap_fdatawrite(inode->i_mapping); - err = file->f_op->fsync(file, dentry, 1); - if (!ret) - ret = err; - err = filemap_fdatawait(inode->i_mapping); - if (!ret) - ret = err; - current->flags &= ~PF_SYNCWRITE; - up(&inode->i_sem); -out_putf: - fput(file); -out: - return ret; -} /* * Various filesystems appear to want __find_get_block to be non-blocking. @@ -1562,35 +1415,6 @@ } /** - * try_to_release_page() - release old fs-specific metadata on a page - * - * @page: the page which the kernel is trying to free - * @gfp_mask: memory allocation flags (and I/O mode) - * - * The address_space is to try to release any data against the page - * (presumably at page->private). If the release was successful, return `1'. - * Otherwise return zero. - * - * The @gfp_mask argument specifies whether I/O may be performed to release - * this page (__GFP_IO), and whether the call may block (__GFP_WAIT). - * - * NOTE: @gfp_mask may go away, and this function may become non-blocking. - */ -int try_to_release_page(struct page *page, int gfp_mask) -{ - struct address_space * const mapping = page->mapping; - - if (!PageLocked(page)) - BUG(); - if (PageWriteback(page)) - return 0; - - if (mapping && mapping->a_ops->releasepage) - return mapping->a_ops->releasepage(page, gfp_mask); - return try_to_free_buffers(page); -} - -/** * block_invalidatepage - invalidate part of all of a buffer-backed page * * @page: the page which is affected @@ -2894,33 +2718,6 @@ } /* - * There are no bdflush tunables left. But distributions are - * still running obsolete flush daemons, so we terminate them here. - * - * Use of bdflush() is deprecated and will be removed in a future kernel. - * The `pdflush' kernel threads fully replace bdflush daemons and this call. - */ -asmlinkage long sys_bdflush(int func, long data) -{ - static int msg_count; - - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - - if (msg_count < 5) { - msg_count++; - printk(KERN_INFO - "warning: process `%s' used the obsolete bdflush" - " system call\n", current->comm); - printk(KERN_INFO "Fix your initscripts?\n"); - } - - if (func == 1) - do_exit(0); - return 0; -} - -/* * Buffer-head allocation */ static kmem_cache_t *bh_cachep; @@ -3054,7 +2851,6 @@ EXPORT_SYMBOL(end_buffer_async_write); EXPORT_SYMBOL(end_buffer_read_sync); EXPORT_SYMBOL(end_buffer_write_sync); -EXPORT_SYMBOL(file_fsync); EXPORT_SYMBOL(fsync_bdev); EXPORT_SYMBOL(fsync_buffers_list); EXPORT_SYMBOL(generic_block_bmap); diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/dcache.c linux-2.6.1-rc1-tiny1.config-block/fs/dcache.c --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/dcache.c Sat Jan 3 22:09:11 2004 +++ linux-2.6.1-rc1-tiny1.config-block/fs/dcache.c Thu Jan 8 11:29:14 2004 @@ -1598,7 +1598,12 @@ EXPORT_SYMBOL(d_genocide); +#ifdef CONFIG_BLOCK extern void bdev_cache_init(void); +#else +static inline void bdev_cache_init(void) {} +#endif + extern void chrdev_init(void); void __init vfs_caches_init(unsigned long mempages) diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/fs-writeback.c linux-2.6.1-rc1-tiny1.config-block/fs/fs-writeback.c --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/fs-writeback.c Wed Dec 17 20:00:00 2003 +++ linux-2.6.1-rc1-tiny1.config-block/fs/fs-writeback.c Thu Jan 8 11:29:14 2004 @@ -23,7 +23,9 @@ #include #include +#ifdef CONFIG_BLOCK extern struct super_block *blockdev_superblock; +#endif /** * __mark_inode_dirty - internal function @@ -263,6 +265,7 @@ struct backing_dev_info *bdi = mapping->backing_dev_info; if (bdi->memory_backed) { +#ifdef CONFIG_BLOCK if (sb == blockdev_superblock) { /* * Dirty memory-backed blockdev: the ramdisk @@ -271,6 +274,7 @@ list_move(&inode->i_list, &sb->s_dirty); continue; } +#endif /* * Assume that all inodes on this superblock are memory * backed. Skip the superblock. @@ -280,15 +284,19 @@ if (wbc->nonblocking && bdi_write_congested(bdi)) { wbc->encountered_congestion = 1; +#ifdef CONFIG_BLOCK if (sb != blockdev_superblock) break; /* Skip a congested fs */ +#endif list_move(&inode->i_list, &sb->s_dirty); continue; /* Skip a congested blockdev */ } if (wbc->bdi && bdi != wbc->bdi) { +#ifdef CONFIG_BLOCK if (sb != blockdev_superblock) break; /* fs has the wrong queue */ +#endif list_move(&inode->i_list, &sb->s_dirty); continue; /* blockdev has wrong queue */ } diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/inode.c linux-2.6.1-rc1-tiny1.config-block/fs/inode.c --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/inode.c Wed Dec 17 19:59:55 2003 +++ linux-2.6.1-rc1-tiny1.config-block/fs/inode.c Thu Jan 8 11:29:14 2004 @@ -245,8 +245,10 @@ DQUOT_DROP(inode); if (inode->i_sb && inode->i_sb->s_op->clear_inode) inode->i_sb->s_op->clear_inode(inode); +#ifdef CONFIG_BLOCK if (inode->i_bdev) bd_forget(inode); +#endif if (inode->i_cdev) cd_forget(inode); inode->i_state = I_CLEAR; @@ -354,6 +356,7 @@ EXPORT_SYMBOL(invalidate_inodes); +#ifdef CONFIG_BLOCK int __invalidate_device(struct block_device *bdev, int do_sync) { struct super_block *sb; @@ -380,6 +383,7 @@ } EXPORT_SYMBOL(__invalidate_device); +#endif static int can_unuse(struct inode *inode) { @@ -1384,6 +1388,17 @@ set_shrinker(DEFAULT_SEEKS, shrink_icache_memory); } + +#ifndef CONFIG_BLOCK +static int no_bdev_open(struct inode *inode, struct file *file) +{ + return -ENXIO; +}; + +struct file_operations def_blk_fops = { + .open = no_bdev_open, +}; +#endif void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev) { diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/mpage.c linux-2.6.1-rc1-tiny1.config-block/fs/mpage.c --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/mpage.c Wed Dec 17 19:58:28 2003 +++ linux-2.6.1-rc1-tiny1.config-block/fs/mpage.c Thu Jan 8 11:29:14 2004 @@ -27,6 +27,7 @@ #include #include +#ifdef CONFIG_BLOCK /* * I/O completion handler for multipage BIOs. * @@ -576,6 +577,8 @@ return bio; } +#endif /* CONFIG_BLOCK */ + /** * mpage_writepages - walk the list of dirty pages of the given * address space and writepage() all of them. @@ -620,8 +623,10 @@ struct writeback_control *wbc, get_block_t get_block) { struct backing_dev_info *bdi = mapping->backing_dev_info; +#ifdef CONFIG_BLOCK struct bio *bio = NULL; sector_t last_block_in_bio = 0; +#endif int ret = 0; int done = 0; int (*writepage)(struct page *page, struct writeback_control *wbc); @@ -631,8 +636,10 @@ return 0; } +#ifdef CONFIG_BLOCK writepage = NULL; if (get_block == NULL) +#endif writepage = mapping->a_ops->writepage; spin_lock(&mapping->page_lock); @@ -671,7 +678,9 @@ if (page->mapping == mapping && !PageWriteback(page) && test_clear_page_dirty(page)) { +#ifdef CONFIG_BLOCK if (writepage) { +#endif ret = (*writepage)(page, wbc); if (ret) { if (ret == -ENOSPC) @@ -681,10 +690,13 @@ set_bit(AS_EIO, &mapping->flags); } - } else { +#ifdef CONFIG_BLOCK + } + else { bio = mpage_writepage(bio, page, get_block, &last_block_in_bio, &ret, wbc); } +#endif if (ret || (--(wbc->nr_to_write) <= 0)) done = 1; if (wbc->nonblocking && bdi_write_congested(bdi)) { @@ -701,8 +713,10 @@ * Leave any remaining dirty pages on ->io_pages */ spin_unlock(&mapping->page_lock); +#ifdef CONFIG_BLOCK if (bio) mpage_bio_submit(WRITE, bio); +#endif return ret; } EXPORT_SYMBOL(mpage_writepages); diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/partitions/Makefile linux-2.6.1-rc1-tiny1.config-block/fs/partitions/Makefile --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/partitions/Makefile Wed Dec 17 19:58:47 2003 +++ linux-2.6.1-rc1-tiny1.config-block/fs/partitions/Makefile Thu Jan 8 11:29:14 2004 @@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -obj-y := check.o +obj-$(CONFIG_BLOCK) := check.o obj-$(CONFIG_DEVFS_FS) += devfs.o obj-$(CONFIG_ACORN_PARTITION) += acorn.o diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/super.c linux-2.6.1-rc1-tiny1.config-block/fs/super.c --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/super.c Wed Dec 17 19:58:48 2003 +++ linux-2.6.1-rc1-tiny1.config-block/fs/super.c Thu Jan 8 11:29:14 2004 @@ -18,6 +18,8 @@ * Torbjörn Lindh (torbjorn.lindh@gopta.se), April 14, 1996. * Added devfs support: Richard Gooch , 13-JAN-1998 * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000 + * Moved block device specific functions to block_dev.c + * Eric Biederman 8 Jan 2004 */ #include @@ -499,37 +501,6 @@ return 0; } -static void do_emergency_remount(unsigned long foo) -{ - struct super_block *sb; - - spin_lock(&sb_lock); - list_for_each_entry(sb, &super_blocks, s_list) { - sb->s_count++; - spin_unlock(&sb_lock); - down_read(&sb->s_umount); - if (sb->s_root && sb->s_bdev && !(sb->s_flags & MS_RDONLY)) { - /* - * ->remount_fs needs lock_kernel(). - * - * What lock protects sb->s_flags?? - */ - lock_kernel(); - do_remount_sb(sb, MS_RDONLY, NULL, 1); - unlock_kernel(); - } - drop_super(sb); - spin_lock(&sb_lock); - } - spin_unlock(&sb_lock); - printk("Emergency Remount complete\n"); -} - -void emergency_remount(void) -{ - pdflush_operation(do_emergency_remount, 0); -} - /* * Unnamed block devices are dummy devices used by virtual * filesystems which don't use real block-devices. -- jrs @@ -575,76 +546,6 @@ } EXPORT_SYMBOL(kill_litter_super); - -static int set_bdev_super(struct super_block *s, void *data) -{ - s->s_bdev = data; - s->s_dev = s->s_bdev->bd_dev; - return 0; -} - -static int test_bdev_super(struct super_block *s, void *data) -{ - return (void *)s->s_bdev == data; -} - -struct super_block *get_sb_bdev(struct file_system_type *fs_type, - int flags, const char *dev_name, void *data, - int (*fill_super)(struct super_block *, void *, int)) -{ - struct block_device *bdev; - struct super_block *s; - int error = 0; - - bdev = open_bdev_excl(dev_name, flags, BDEV_FS, fs_type); - if (IS_ERR(bdev)) - return (struct super_block *)bdev; - - s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); - if (IS_ERR(s)) - goto out; - - if (s->s_root) { - if ((flags ^ s->s_flags) & MS_RDONLY) { - up_write(&s->s_umount); - deactivate_super(s); - s = ERR_PTR(-EBUSY); - } - goto out; - } else { - char b[BDEVNAME_SIZE]; - - s->s_flags = flags; - strncpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); - s->s_old_blocksize = block_size(bdev); - sb_set_blocksize(s, s->s_old_blocksize); - error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0); - if (error) { - up_write(&s->s_umount); - deactivate_super(s); - s = ERR_PTR(error); - } else - s->s_flags |= MS_ACTIVE; - } - - return s; - -out: - close_bdev_excl(bdev, BDEV_FS); - return s; -} - -EXPORT_SYMBOL(get_sb_bdev); - -void kill_block_super(struct super_block *sb) -{ - struct block_device *bdev = sb->s_bdev; - generic_shutdown_super(sb); - set_blocksize(bdev, sb->s_old_blocksize); - close_bdev_excl(bdev, BDEV_FS); -} - -EXPORT_SYMBOL(kill_block_super); struct super_block *get_sb_nodev(struct file_system_type *fs_type, int flags, void *data, diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/fs/sync.c linux-2.6.1-rc1-tiny1.config-block/fs/sync.c --- linux-2.6.1-rc1-tiny1.compile-fixes/fs/sync.c Wed Dec 31 17:00:00 1969 +++ linux-2.6.1-rc1-tiny1.config-block/fs/sync.c Thu Jan 8 11:29:14 2004 @@ -0,0 +1,201 @@ +/* + * linux/fs/sync.c + * + * Copyright (C) 1991, 1992, 2002 Linus Torvalds + * And others see buffer.c + */ + +/* + * Moved here from buffer.c 8 Jan 2004 Eric Biederman + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Write out and wait upon all dirty data associated with this + * superblock. Filesystem data as well as the underlying block + * device. Takes the superblock lock. + */ +int fsync_super(struct super_block *sb) +{ + sync_inodes_sb(sb, 0); + DQUOT_SYNC(sb); + lock_super(sb); + if (sb->s_dirt && sb->s_op->write_super) + sb->s_op->write_super(sb); + unlock_super(sb); + if (sb->s_op->sync_fs) + sb->s_op->sync_fs(sb, 1); + sync_blockdev(sb->s_bdev); + sync_inodes_sb(sb, 1); + + return sync_blockdev(sb->s_bdev); +} + +/* + * sync everything. Start out by waking pdflush, because that writes back + * all queues in parallel. + */ +static void do_sync(unsigned long wait) +{ + wakeup_bdflush(0); + sync_inodes(0); /* All mappings, inodes and their blockdevs */ + DQUOT_SYNC(NULL); + sync_supers(); /* Write the superblocks */ + sync_filesystems(0); /* Start syncing the filesystems */ + sync_filesystems(wait); /* Waitingly sync the filesystems */ + sync_inodes(wait); /* Mappings, inodes and blockdevs, again. */ + if (!wait) + printk("Emergency Sync complete\n"); +} + +asmlinkage long sys_sync(void) +{ + do_sync(1); + return 0; +} + +void emergency_sync(void) +{ + pdflush_operation(do_sync, 0); +} + +/* + * Generic function to fsync a file. + * + * filp may be NULL if called via the msync of a vma. + */ + +int file_fsync(struct file *filp, struct dentry *dentry, int datasync) +{ + struct inode * inode = dentry->d_inode; + struct super_block * sb; + int ret; + + /* sync the inode to buffers */ + write_inode_now(inode, 0); + + /* sync the superblock to buffers */ + sb = inode->i_sb; + lock_super(sb); + if (sb->s_op->write_super) + sb->s_op->write_super(sb); + unlock_super(sb); + + /* .. finally sync the buffers to disk */ + ret = sync_blockdev(sb->s_bdev); + return ret; +} +EXPORT_SYMBOL(file_fsync); + +asmlinkage long sys_fsync(unsigned int fd) +{ + struct file * file; + struct dentry * dentry; + struct inode * inode; + int ret, err; + + ret = -EBADF; + file = fget(fd); + if (!file) + goto out; + + dentry = file->f_dentry; + inode = dentry->d_inode; + + ret = -EINVAL; + if (!file->f_op || !file->f_op->fsync) { + /* Why? We can still call filemap_fdatawrite */ + goto out_putf; + } + + /* We need to protect against concurrent writers.. */ + down(&inode->i_sem); + current->flags |= PF_SYNCWRITE; + ret = filemap_fdatawrite(inode->i_mapping); + err = file->f_op->fsync(file, dentry, 0); + if (!ret) + ret = err; + err = filemap_fdatawait(inode->i_mapping); + if (!ret) + ret = err; + current->flags &= ~PF_SYNCWRITE; + up(&inode->i_sem); + +out_putf: + fput(file); +out: + return ret; +} + +asmlinkage long sys_fdatasync(unsigned int fd) +{ + struct file * file; + struct dentry * dentry; + struct inode * inode; + int ret, err; + + ret = -EBADF; + file = fget(fd); + if (!file) + goto out; + + dentry = file->f_dentry; + inode = dentry->d_inode; + + ret = -EINVAL; + if (!file->f_op || !file->f_op->fsync) + goto out_putf; + + down(&inode->i_sem); + current->flags |= PF_SYNCWRITE; + ret = filemap_fdatawrite(inode->i_mapping); + err = file->f_op->fsync(file, dentry, 1); + if (!ret) + ret = err; + err = filemap_fdatawait(inode->i_mapping); + if (!ret) + ret = err; + current->flags &= ~PF_SYNCWRITE; + up(&inode->i_sem); + +out_putf: + fput(file); +out: + return ret; +} + +/* + * There are no bdflush tunables left. But distributions are + * still running obsolete flush daemons, so we terminate them here. + * + * Use of bdflush() is deprecated and will be removed in a future kernel. + * The `pdflush' kernel threads fully replace bdflush daemons and this call. + */ +asmlinkage long sys_bdflush(int func, long data) +{ + static int msg_count; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + + if (msg_count < 5) { + msg_count++; + printk(KERN_INFO + "warning: process `%s' used the obsolete bdflush" + " system call\n", current->comm); + printk(KERN_INFO "Fix your initscripts?\n"); + } + + if (func == 1) + do_exit(0); + return 0; +} diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/include/linux/blkdev.h linux-2.6.1-rc1-tiny1.config-block/include/linux/blkdev.h --- linux-2.6.1-rc1-tiny1.compile-fixes/include/linux/blkdev.h Wed Dec 17 19:58:28 2003 +++ linux-2.6.1-rc1-tiny1.config-block/include/linux/blkdev.h Thu Jan 8 11:29:14 2004 @@ -577,7 +577,11 @@ extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); extern void blk_dump_rq_flags(struct request *, char *); extern void generic_unplug_device(void *); +#ifdef CONFIG_BLOCK extern long nr_blockdev_pages(void); +#else +static inline long nr_blockdev_pages(void) { return 0; } +#endif int blk_get_queue(request_queue_t *); request_queue_t *blk_alloc_queue(int); @@ -596,7 +600,12 @@ extern void blk_queue_free_tags(request_queue_t *); extern int blk_queue_resize_tags(request_queue_t *, int); extern void blk_queue_invalidate_tags(request_queue_t *); + +#ifdef CONFIG_BLOCK extern void blk_congestion_wait(int rw, long timeout); +#else +static inline void blk_congestion_wait(int rw, long timeout) {} +#endif extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *); extern void blk_rq_prep_restart(struct request *); diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/include/linux/buffer_head.h linux-2.6.1-rc1-tiny1.config-block/include/linux/buffer_head.h --- linux-2.6.1-rc1-tiny1.compile-fixes/include/linux/buffer_head.h Wed Dec 17 19:58:04 2003 +++ linux-2.6.1-rc1-tiny1.config-block/include/linux/buffer_head.h Thu Jan 8 11:29:14 2004 @@ -150,17 +150,26 @@ void buffer_insert_list(spinlock_t *lock, struct buffer_head *, struct list_head *); void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode); +#ifdef CONFIG_BLOCK int inode_has_buffers(struct inode *); void invalidate_inode_buffers(struct inode *); int remove_inode_buffers(struct inode *inode); -int fsync_buffers_list(spinlock_t *lock, struct list_head *); int sync_mapping_buffers(struct address_space *mapping); +int sync_blockdev(struct block_device *bdev); +#else +static inline int inode_has_buffers(struct inode *inode) { return 0; } +static inline void invalidate_inode_buffers(struct inode *inode) { } +static inline int remove_inode_buffers(struct inode *inode) { return 1; } +static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; } +static inline int sync_blockdev(struct block_device *bdev) { return 0; } +#endif +int fsync_buffers_list(spinlock_t *lock, struct list_head *); + void unmap_underlying_metadata(struct block_device *bdev, sector_t block); void mark_buffer_async_read(struct buffer_head *bh); void mark_buffer_async_write(struct buffer_head *bh); void invalidate_bdev(struct block_device *, int); -int sync_blockdev(struct block_device *bdev); void __wait_on_buffer(struct buffer_head *); wait_queue_head_t *bh_waitq_head(struct buffer_head *bh); void wake_up_buffer(struct buffer_head *bh); diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/include/linux/fs.h linux-2.6.1-rc1-tiny1.config-block/include/linux/fs.h --- linux-2.6.1-rc1-tiny1.compile-fixes/include/linux/fs.h Sun Jan 4 00:03:57 2004 +++ linux-2.6.1-rc1-tiny1.config-block/include/linux/fs.h Thu Jan 8 11:29:14 2004 @@ -1145,7 +1145,11 @@ extern int blkdev_put(struct block_device *, int); extern int bd_claim(struct block_device *, void *); extern void bd_release(struct block_device *); +#ifdef CONFIG_BLOCK extern void blk_run_queues(void); +#else +static inline void blk_run_queues(void) {}; +#endif /* fs/char_dev.c */ extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, char *); @@ -1210,7 +1214,11 @@ extern void sync_supers(void); extern void sync_filesystems(int wait); extern void emergency_sync(void); +#ifdef CONFIG_bLOCK extern void emergency_remount(void); +#else +static inline void emergency_remount(void) {} +#endif extern int do_remount_sb(struct super_block *sb, int flags, void *data, int force); extern sector_t bmap(struct inode *, sector_t); @@ -1290,7 +1298,11 @@ extern void file_kill(struct file *f); struct bio; extern int submit_bio(int, struct bio *); +#ifdef CONFIG_BLOCK extern int bdev_read_only(struct block_device *); +#else +static inline int bdev_read_only(struct block_device *bdev) { return 0; } +#endif extern int set_blocksize(struct block_device *, int); extern int sb_set_blocksize(struct super_block *, int); extern int sb_min_blocksize(struct super_block *, int); diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/include/linux/mm.h linux-2.6.1-rc1-tiny1.config-block/include/linux/mm.h --- linux-2.6.1-rc1-tiny1.compile-fixes/include/linux/mm.h Sat Jan 3 22:09:12 2004 +++ linux-2.6.1-rc1-tiny1.config-block/include/linux/mm.h Thu Jan 8 11:29:14 2004 @@ -486,7 +486,11 @@ if (spd) return (*spd)(page); } +#if CONFIG_BLOCK return __set_page_dirty_buffers(page); +#else + return 0; +#endif } /* diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/init/Kconfig linux-2.6.1-rc1-tiny1.config-block/init/Kconfig --- linux-2.6.1-rc1-tiny1.compile-fixes/init/Kconfig Sun Jan 4 00:03:57 2004 +++ linux-2.6.1-rc1-tiny1.config-block/init/Kconfig Thu Jan 8 11:29:14 2004 @@ -276,6 +276,7 @@ Disabling this option will cause the kernel to be built without support for epoll family of system calls. +source "drivers/block/Kconfig.embedded" source "drivers/block/Kconfig.iosched" config CC_OPTIMIZE_FOR_SIZE diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/init/do_mounts.c linux-2.6.1-rc1-tiny1.config-block/init/do_mounts.c --- linux-2.6.1-rc1-tiny1.compile-fixes/init/do_mounts.c Sun Jan 4 00:03:57 2004 +++ linux-2.6.1-rc1-tiny1.config-block/init/do_mounts.c Thu Jan 8 11:29:14 2004 @@ -267,6 +267,7 @@ return 0; } +#ifdef CONFIG_BLOCK void __init mount_block_root(char *name, int flags) { char *fs_names = __getname(); @@ -301,6 +302,7 @@ out: putname(fs_names); } +#endif /* CONFIG_BLOCK */ #ifdef CONFIG_ROOT_NFS static int __init mount_nfs_root(void) @@ -368,8 +370,10 @@ change_floppy("root floppy"); } #endif +#ifdef CONFIG_BLOCK create_dev("/dev/root", ROOT_DEV, root_device_name); mount_block_root("/dev/root", root_mountflags); +#endif } /* diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/init/main.c linux-2.6.1-rc1-tiny1.config-block/init/main.c --- linux-2.6.1-rc1-tiny1.compile-fixes/init/main.c Sun Jan 4 00:03:57 2004 +++ linux-2.6.1-rc1-tiny1.config-block/init/main.c Thu Jan 8 11:29:14 2004 @@ -78,7 +78,6 @@ extern void sbus_init(void); extern void sysctl_init(void); extern void signals_init(void); -extern void buffer_init(void); extern void pidhash_init(void); extern void pidmap_init(void); extern void pte_chain_init(void); @@ -89,6 +88,12 @@ #ifdef CONFIG_TC extern void tc_init(void); +#endif + +#ifdef CONFIG_BLOCK +extern void buffer_init(void); +#else +static inline void buffer_init(void) {} #endif /* diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/kernel/exit.c linux-2.6.1-rc1-tiny1.config-block/kernel/exit.c --- linux-2.6.1-rc1-tiny1.compile-fixes/kernel/exit.c Sat Jan 3 22:09:12 2004 +++ linux-2.6.1-rc1-tiny1.config-block/kernel/exit.c Thu Jan 8 11:29:14 2004 @@ -750,8 +750,10 @@ panic("Attempted to kill the idle task!"); if (unlikely(tsk->pid == 1)) panic("Attempted to kill init!"); +#ifdef CONFIG_BLOCK if (tsk->io_context) exit_io_context(); +#endif tsk->flags |= PF_EXITING; del_timer_sync(&tsk->real_timer); diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/mm/filemap.c linux-2.6.1-rc1-tiny1.config-block/mm/filemap.c --- linux-2.6.1-rc1-tiny1.compile-fixes/mm/filemap.c Sat Jan 3 22:09:12 2004 +++ linux-2.6.1-rc1-tiny1.config-block/mm/filemap.c Thu Jan 8 11:29:14 2004 @@ -1639,7 +1639,11 @@ file->f_error = 0; return err; } - +#ifndef CONFIG_BLOCK + if (unlikely(isblk)) { + return -EINVAL; + } +#endif if (!isblk) { /* FIXME: this is for backwards compatibility with 2.4 */ if (file->f_flags & O_APPEND) @@ -1688,7 +1692,9 @@ if (unlikely(*pos + *count > inode->i_sb->s_maxbytes)) *count = inode->i_sb->s_maxbytes - *pos; - } else { + } +#ifdef CONFIG_BLOCK + else { loff_t isize; if (bdev_read_only(inode->i_bdev)) return -EPERM; @@ -1701,6 +1707,7 @@ if (*pos + *count > isize) *count = isize - *pos; } +#endif return 0; } diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/mm/highmem.c linux-2.6.1-rc1-tiny1.config-block/mm/highmem.c --- linux-2.6.1-rc1-tiny1.compile-fixes/mm/highmem.c Sat Jan 3 22:09:12 2004 +++ linux-2.6.1-rc1-tiny1.config-block/mm/highmem.c Thu Jan 8 11:29:14 2004 @@ -300,6 +300,7 @@ } } +#ifdef CONFIG_BLOCK static void bounce_end_io(struct bio *bio, mempool_t *pool) { struct bio *bio_orig = bio->bi_private; @@ -479,6 +480,7 @@ } EXPORT_SYMBOL(blk_queue_bounce); +#endif /* CONFIG_BLOCK */ #if defined(HASHED_PAGE_VIRTUAL) diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/mm/page-writeback.c linux-2.6.1-rc1-tiny1.config-block/mm/page-writeback.c --- linux-2.6.1-rc1-tiny1.compile-fixes/mm/page-writeback.c Wed Dec 17 19:59:05 2003 +++ linux-2.6.1-rc1-tiny1.config-block/mm/page-writeback.c Thu Jan 8 11:29:14 2004 @@ -567,3 +567,37 @@ return 0; } EXPORT_SYMBOL(test_clear_page_dirty); + +/** + * try_to_release_page() - release old fs-specific metadata on a page + * + * @page: the page which the kernel is trying to free + * @gfp_mask: memory allocation flags (and I/O mode) + * + * The address_space is to try to release any data against the page + * (presumably at page->private). If the release was successful, return `1'. + * Otherwise return zero. + * + * The @gfp_mask argument specifies whether I/O may be performed to release + * this page (__GFP_IO), and whether the call may block (__GFP_WAIT). + * + * NOTE: @gfp_mask may go away, and this function may become non-blocking. + */ +int try_to_release_page(struct page *page, int gfp_mask) +{ + struct address_space * const mapping = page->mapping; + + if (!PageLocked(page)) + BUG(); + if (PageWriteback(page)) + return 0; + + if (mapping && mapping->a_ops->releasepage) + return mapping->a_ops->releasepage(page, gfp_mask); +#ifdef CONFIG_BLOCK + return try_to_free_buffers(page); +#else + BUG(); + return 0; +#endif +} diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/mm/swap.c linux-2.6.1-rc1-tiny1.config-block/mm/swap.c --- linux-2.6.1-rc1-tiny1.compile-fixes/mm/swap.c Sat Jan 3 22:09:12 2004 +++ linux-2.6.1-rc1-tiny1.config-block/mm/swap.c Thu Jan 8 11:29:14 2004 @@ -317,6 +317,7 @@ pagevec_reinit(pvec); } +#ifdef CONFIG_BLOCK /* * Try to drop buffers from the pages in a pagevec */ @@ -333,6 +334,7 @@ } } } +#endif /* CONFIG_BLOCK */ /** * pagevec_lookup - gang pagecache lookup diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/mm/truncate.c linux-2.6.1-rc1-tiny1.config-block/mm/truncate.c --- linux-2.6.1-rc1-tiny1.compile-fixes/mm/truncate.c Wed Dec 17 19:59:42 2003 +++ linux-2.6.1-rc1-tiny1.config-block/mm/truncate.c Thu Jan 8 11:29:14 2004 @@ -20,9 +20,11 @@ { int (*invalidatepage)(struct page *, unsigned long); invalidatepage = page->mapping->a_ops->invalidatepage; +#ifdef CONFIG_BLOCK if (invalidatepage == NULL) invalidatepage = block_invalidatepage; - return (*invalidatepage)(page, offset); +#endif + return (invalidatepage) ? (*invalidatepage)(page, offset) : 1; } static inline void truncate_partial_page(struct page *page, unsigned partial) diff -uNr -X linux-ignore-files linux-2.6.1-rc1-tiny1.compile-fixes/mm/vmscan.c linux-2.6.1-rc1-tiny1.config-block/mm/vmscan.c --- linux-2.6.1-rc1-tiny1.compile-fixes/mm/vmscan.c Sat Jan 3 22:09:12 2004 +++ linux-2.6.1-rc1-tiny1.config-block/mm/vmscan.c Thu Jan 8 11:29:14 2004 @@ -704,19 +704,23 @@ spin_unlock_irq(&zone->lru_lock); pgdeactivate += pgmoved; pgmoved = 0; +#ifdef CONFIG_BLOCK if (buffer_heads_over_limit) pagevec_strip(&pvec); +#endif __pagevec_release(&pvec); spin_lock_irq(&zone->lru_lock); } } zone->nr_inactive += pgmoved; pgdeactivate += pgmoved; +#ifdef CONFIG_BLOCK if (buffer_heads_over_limit) { spin_unlock_irq(&zone->lru_lock); pagevec_strip(&pvec); spin_lock_irq(&zone->lru_lock); } +#endif pgmoved = 0; while (!list_empty(&l_active)) {