* 2.5.2-pre2 forces ramfs on @ 2001-12-26 3:41 Keith Owens 2001-12-26 4:17 ` Linus Torvalds 2001-12-26 4:26 ` Alexander Viro 0 siblings, 2 replies; 10+ messages in thread From: Keith Owens @ 2001-12-26 3:41 UTC (permalink / raw) To: linux-kernel; +Cc: Alexander Viro Index: 2-pre1.1/fs/Config.in --- 2-pre1.1/fs/Config.in Sat, 24 Nov 2001 05:28:08 +1100 kaos (linux-2.5/F/d/27_Config.in 1.1 644) +++ 2-pre2.1/fs/Config.in Wed, 26 Dec 2001 14:32:39 +1100 kaos (linux-2.5/F/d/27_Config.in 1.2 644) @@ -45,7 +45,7 @@ if [ "$CONFIG_JFFS2_FS" = "y" -o "$CONFI fi tristate 'Compressed ROM file system support' CONFIG_CRAMFS bool 'Virtual memory file system support (former shm fs)' CONFIG_TMPFS -tristate 'Simple RAM-based file system support' CONFIG_RAMFS +define_bool CONFIG_RAMFS y Why is ramfs forced on? And why is Al Viro's email address not in CREDITS or MAINTAINERS? We should have somewhere to complain to ;). ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.5.2-pre2 forces ramfs on 2001-12-26 3:41 2.5.2-pre2 forces ramfs on Keith Owens @ 2001-12-26 4:17 ` Linus Torvalds 2001-12-26 15:04 ` Alan Cox 2001-12-26 4:26 ` Alexander Viro 1 sibling, 1 reply; 10+ messages in thread From: Linus Torvalds @ 2001-12-26 4:17 UTC (permalink / raw) To: linux-kernel In article <2452.1009338062@ocs3.intra.ocs.com.au>, Keith Owens <kaos@ocs.com.au> wrote: > >Why is ramfs forced on? Because it's small, and if it wasn't there, we'd have to have the small "rootfs" anyway (which basically duplicated ramfs functionality). >And why is Al Viro's email address not in CREDITS or MAINTAINERS? We >should have somewhere to complain to ;). He didn't want to be in either file at some point (yes, I asked him), some day I'll put him in anyway (he's been the effective maintainer of the VFS interface for the last year or so, regardless of whether he wants to be in the MAINTAINTERS file or not). Linus ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.5.2-pre2 forces ramfs on 2001-12-26 4:17 ` Linus Torvalds @ 2001-12-26 15:04 ` Alan Cox 2001-12-26 17:20 ` Legacy Fishtank 2001-12-26 22:04 ` Linus Torvalds 0 siblings, 2 replies; 10+ messages in thread From: Alan Cox @ 2001-12-26 15:04 UTC (permalink / raw) To: Linus Torvalds; +Cc: linux-kernel > Because it's small, and if it wasn't there, we'd have to have the small > "rootfs" anyway (which basically duplicated ramfs functionality). Can ramfs=N longer term actually come back to be "use __init for the RAM fs functions". That would seem to address any space issues even the most embedded fanatic has. Alan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.5.2-pre2 forces ramfs on 2001-12-26 15:04 ` Alan Cox @ 2001-12-26 17:20 ` Legacy Fishtank 2001-12-26 17:36 ` Alexander Viro 2001-12-26 22:04 ` Linus Torvalds 1 sibling, 1 reply; 10+ messages in thread From: Legacy Fishtank @ 2001-12-26 17:20 UTC (permalink / raw) To: Alan Cox; +Cc: Linus Torvalds, linux-kernel On Wed, Dec 26, 2001 at 03:04:40PM +0000, Alan Cox wrote: > > Because it's small, and if it wasn't there, we'd have to have the small > > "rootfs" anyway (which basically duplicated ramfs functionality). > > Can ramfs=N longer term actually come back to be "use __init for the RAM > fs functions". That would seem to address any space issues even the most > embedded fanatic has. Nifty idea... We could use __rootfs or similar in the module. Jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.5.2-pre2 forces ramfs on 2001-12-26 17:20 ` Legacy Fishtank @ 2001-12-26 17:36 ` Alexander Viro 2001-12-26 17:52 ` Legacy Fishtank ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Alexander Viro @ 2001-12-26 17:36 UTC (permalink / raw) To: Legacy Fishtank; +Cc: Alan Cox, Linus Torvalds, linux-kernel On Wed, 26 Dec 2001, Legacy Fishtank wrote: > On Wed, Dec 26, 2001 at 03:04:40PM +0000, Alan Cox wrote: > > > Because it's small, and if it wasn't there, we'd have to have the small > > > "rootfs" anyway (which basically duplicated ramfs functionality). > > > > Can ramfs=N longer term actually come back to be "use __init for the RAM > > fs functions". That would seem to address any space issues even the most > > embedded fanatic has. > > Nifty idea... We could use __rootfs or similar in the module. Um, folks - rootfs does _not_ go away after you mount final root over it. Having absolute root always there makes life much simpler in a lot of places... What's more, quite a few ramfs methods are good candidates for library functions, since they are already shared with other filesystems and number of such cases is going to grow. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.5.2-pre2 forces ramfs on 2001-12-26 17:36 ` Alexander Viro @ 2001-12-26 17:52 ` Legacy Fishtank 2001-12-27 10:39 ` Christoph Rohland 2002-01-05 22:35 ` Eric W. Biederman 2 siblings, 0 replies; 10+ messages in thread From: Legacy Fishtank @ 2001-12-26 17:52 UTC (permalink / raw) To: Alexander Viro; +Cc: Alan Cox, Linus Torvalds, linux-kernel On Wed, Dec 26, 2001 at 12:36:09PM -0500, Alexander Viro wrote: > What's more, quite a few ramfs methods are good candidates for library > functions, since they are already shared with other filesystems and > number of such cases is going to grow. Good point, ext2meta uses the ramfs aops... Jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.5.2-pre2 forces ramfs on 2001-12-26 17:36 ` Alexander Viro 2001-12-26 17:52 ` Legacy Fishtank @ 2001-12-27 10:39 ` Christoph Rohland 2002-01-05 22:35 ` Eric W. Biederman 2 siblings, 0 replies; 10+ messages in thread From: Christoph Rohland @ 2001-12-27 10:39 UTC (permalink / raw) To: Alexander Viro; +Cc: Legacy Fishtank, Alan Cox, Linus Torvalds, linux-kernel [-- Attachment #1: Type: text/plain, Size: 687 bytes --] Hi Al, On Wed, 26 Dec 2001, Alexander Viro wrote: > What's more, quite a few ramfs methods are good candidates for > library functions, since they are already shared with other > filesystems and number of such cases is going to grow. Comments on the following set of patches? 1) Add a removepage operation to the address_space_operations which simplifies the size checking heavily. This is not strictly needed. 2) Add a ramfs(2) incorporation to shmem.c which disables the swapping and does not allocate the swap vector for shmem.c files. We would gain a full ramfs with size checking, error checking and correct time stamping with a very small change. Greetings Christoph [-- Attachment #2: patch-removepage --] [-- Type: text/plain, Size: 4090 bytes --] diff -uNr 17-rc1/include/linux/fs.h 17-rc1-removepage/include/linux/fs.h --- 17-rc1/include/linux/fs.h Sun Dec 16 10:27:45 2001 +++ 17-rc1-removepage/include/linux/fs.h Sun Dec 16 10:36:26 2001 @@ -391,6 +391,7 @@ int (*releasepage) (struct page *, int); #define KERNEL_HAS_O_DIRECT /* this is for modules out of the kernel */ int (*direct_IO)(int, struct inode *, struct kiobuf *, unsigned long, int); + void (*removepage)(struct page *); /* called when page gets removed from the inode */ }; struct address_space { diff -uNr 17-rc1/mm/filemap.c 17-rc1-removepage/mm/filemap.c --- 17-rc1/mm/filemap.c Sun Dec 16 10:27:48 2001 +++ 17-rc1-removepage/mm/filemap.c Sun Dec 16 10:31:55 2001 @@ -96,6 +96,9 @@ { struct address_space * mapping = page->mapping; + if (mapping->a_ops->removepage) + mapping->a_ops->removepage(page); + mapping->nrpages--; list_del(&page->list); page->mapping = NULL; diff -uNr 17-rc1/mm/shmem.c 17-rc1-removepage/mm/shmem.c --- 17-rc1/mm/shmem.c Sun Dec 16 10:27:48 2001 +++ 17-rc1-removepage/mm/shmem.c Sun Dec 16 11:17:47 2001 @@ -47,43 +47,25 @@ LIST_HEAD (shmem_inodes); static spinlock_t shmem_ilock = SPIN_LOCK_UNLOCKED; -atomic_t shmem_nrpages = ATOMIC_INIT(0); /* Not used right now */ +atomic_t shmem_nrpages = ATOMIC_INIT(0); #define BLOCKS_PER_PAGE (PAGE_CACHE_SIZE/512) -/* - * shmem_recalc_inode - recalculate the size of an inode - * - * @inode: inode to recalc - * @swap: additional swap pages freed externally - * - * We have to calculate the free blocks since the mm can drop pages - * behind our back - * - * But we know that normally - * inodes->i_blocks/BLOCKS_PER_PAGE == - * inode->i_mapping->nrpages + info->swapped - * - * So the mm freed - * inodes->i_blocks/BLOCKS_PER_PAGE - - * (inode->i_mapping->nrpages + info->swapped) - * - * It has to be called with the spinlock held. - */ - -static void shmem_recalc_inode(struct inode * inode) +static void shmem_removepage(struct page *page) { - unsigned long freed; + struct inode * inode; + struct shmem_sb_info * sbinfo; - freed = (inode->i_blocks/BLOCKS_PER_PAGE) - - (inode->i_mapping->nrpages + SHMEM_I(inode)->swapped); - if (freed){ - struct shmem_sb_info * sbinfo = SHMEM_SB(inode->i_sb); - inode->i_blocks -= freed*BLOCKS_PER_PAGE; - spin_lock (&sbinfo->stat_lock); - sbinfo->free_blocks += freed; - spin_unlock (&sbinfo->stat_lock); - } + atomic_dec(&shmem_nrpages); + if (PageLaunder(page)) + return; + + inode = page->mapping->host; + sbinfo = SHMEM_SB(inode->i_sb); + inode->i_blocks -= BLOCKS_PER_PAGE; + spin_lock (&sbinfo->stat_lock); + sbinfo->free_blocks++; + spin_unlock (&sbinfo->stat_lock); } /* @@ -315,6 +297,7 @@ unsigned long index; unsigned long freed = 0; struct shmem_inode_info * info = SHMEM_I(inode); + struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); down(&info->sem); inode->i_ctime = inode->i_mtime = CURRENT_TIME; @@ -325,8 +308,11 @@ freed += shmem_truncate_indirect(info, index); info->swapped -= freed; - shmem_recalc_inode(inode); + inode->i_blocks -= freed*BLOCKS_PER_PAGE; spin_unlock (&info->lock); + spin_lock (&sbinfo->stat_lock); + sbinfo->free_blocks += freed; + spin_unlock (&sbinfo->stat_lock); up(&info->sem); } @@ -385,6 +371,7 @@ return 0; found: delete_from_swap_cache(page); + atomic_inc(&shmem_nrpages); add_to_page_cache(page, info->inode->i_mapping, offset + idx); SetPageDirty(page); SetPageUptodate(page); @@ -446,7 +433,6 @@ entry = shmem_swp_entry(info, index, 0); if (IS_ERR(entry)) /* this had been allocated on page allocation */ BUG(); - shmem_recalc_inode(inode); if (entry->val) BUG(); @@ -517,7 +503,6 @@ return page; } - shmem_recalc_inode(inode); if (entry->val) { unsigned long flags; @@ -583,6 +568,7 @@ /* We have the page */ SetPageUptodate(page); + atomic_inc(&shmem_nrpages); return page; no_space: spin_unlock (&sbinfo->stat_lock); @@ -1325,6 +1311,7 @@ static struct address_space_operations shmem_aops = { + removepage: shmem_removepage, writepage: shmem_writepage, }; [-- Attachment #3: patch-ramfs2 --] [-- Type: text/plain, Size: 4430 bytes --] diff -uNr 17-rc1-removepage/mm/shmem.c c/mm/shmem.c --- 17-rc1-removepage/mm/shmem.c Sun Dec 16 11:31:21 2001 +++ c/mm/shmem.c Sun Dec 16 15:04:34 2001 @@ -36,15 +36,28 @@ #define ENTRIES_PER_PAGE (PAGE_CACHE_SIZE/sizeof(unsigned long)) #define SHMEM_SB(sb) (&sb->u.shmem_sb) +#define SHMEM_NOSWAP(info) ((info)->locked == 2) static struct super_operations shmem_ops; static struct address_space_operations shmem_aops; +static struct address_space_operations shmem_noswap_aops; static struct file_operations shmem_file_operations; static struct inode_operations shmem_inode_operations; static struct file_operations shmem_dir_operations; static struct inode_operations shmem_dir_inode_operations; static struct vm_operations_struct shmem_vm_ops; +static struct super_block *shmem_read_super(struct super_block * sb, void * data, int silent); + +#ifdef CONFIG_TMPFS +/* type "shm" will be tagged obsolete in 2.5 */ +static DECLARE_FSTYPE(shmem_fs_type, "shm", shmem_read_super, FS_LITTER); +static DECLARE_FSTYPE(tmpfs_fs_type, "tmpfs", shmem_read_super, FS_LITTER); +static DECLARE_FSTYPE(ramfs2_fs_type, "ramfs2", shmem_read_super, FS_LITTER); +#else +static DECLARE_FSTYPE(tmpfs_fs_type, "tmpfs", shmem_read_super, FS_LITTER|FS_NOMOUNT); +#endif + LIST_HEAD (shmem_inodes); static spinlock_t shmem_ilock = SPIN_LOCK_UNLOCKED; atomic_t shmem_nrpages = ATOMIC_INIT(0); @@ -299,8 +312,11 @@ struct shmem_inode_info * info = SHMEM_I(inode); struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); - down(&info->sem); inode->i_ctime = inode->i_mtime = CURRENT_TIME; + if (SHMEM_NOSWAP(info)) + return; + + down(&info->sem); spin_lock (&info->lock); index = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; @@ -352,6 +368,9 @@ unsigned long idx; int offset; + if (SHMEM_NOSWAP(info)) + return 0; + idx = 0; spin_lock (&info->lock); offset = shmem_clear_swp (entry, info->i_direct, SHMEM_NR_DIRECT); @@ -484,6 +503,9 @@ if (page) return page; + if (SHMEM_NOSWAP(info)) + goto noswap_alloc; + entry = shmem_alloc_entry (info, idx); if (IS_ERR(entry)) return (void *)entry; @@ -543,6 +565,7 @@ info->swapped--; spin_unlock (&info->lock); } else { + noswap_alloc: sbinfo = SHMEM_SB(inode->i_sb); spin_unlock (&info->lock); spin_lock (&sbinfo->stat_lock); @@ -628,8 +651,11 @@ struct inode * inode = file->f_dentry->d_inode; struct shmem_inode_info * info = SHMEM_I(inode); + if (SHMEM_NOSWAP(info)) + return; + down(&info->sem); - info->locked = lock; + info->locked = (lock != 0); up(&info->sem); } @@ -668,12 +694,19 @@ inode->i_blksize = PAGE_CACHE_SIZE; inode->i_blocks = 0; inode->i_rdev = NODEV; - inode->i_mapping->a_ops = &shmem_aops; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; info = SHMEM_I(inode); info->inode = inode; spin_lock_init (&info->lock); sema_init (&info->sem, 1); + + if (sb->s_type == &ramfs2_fs_type) { + info->locked = 2; + inode->i_mapping->a_ops = &shmem_noswap_aops; + } else { + inode->i_mapping->a_ops = &shmem_aops; + } + switch (mode & S_IFMT) { default: init_special_inode(inode, mode, dev); @@ -1310,6 +1343,11 @@ +static struct address_space_operations shmem_noswap_aops = { + removepage: shmem_removepage, + writepage: fail_writepage, +}; + static struct address_space_operations shmem_aops = { removepage: shmem_removepage, writepage: shmem_writepage, @@ -1363,13 +1401,6 @@ nopage: shmem_nopage, }; -#ifdef CONFIG_TMPFS -/* type "shm" will be tagged obsolete in 2.5 */ -static DECLARE_FSTYPE(shmem_fs_type, "shm", shmem_read_super, FS_LITTER); -static DECLARE_FSTYPE(tmpfs_fs_type, "tmpfs", shmem_read_super, FS_LITTER); -#else -static DECLARE_FSTYPE(tmpfs_fs_type, "tmpfs", shmem_read_super, FS_LITTER|FS_NOMOUNT); -#endif static struct vfsmount *shm_mnt; static int __init init_shmem_fs(void) @@ -1382,6 +1413,11 @@ return error; } #ifdef CONFIG_TMPFS + if ((error = register_filesystem(&ramfs2_fs_type))) { + printk (KERN_ERR "Could not register ramfs2\n"); + return error; + } + if ((error = register_filesystem(&shmem_fs_type))) { printk (KERN_ERR "Could not register shm fs\n"); return error; @@ -1407,6 +1443,7 @@ { #ifdef CONFIG_TMPFS unregister_filesystem(&shmem_fs_type); + unregister_filesystem(&ramfs2_fs_type); #endif unregister_filesystem(&tmpfs_fs_type); mntput(shm_mnt); ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.5.2-pre2 forces ramfs on 2001-12-26 17:36 ` Alexander Viro 2001-12-26 17:52 ` Legacy Fishtank 2001-12-27 10:39 ` Christoph Rohland @ 2002-01-05 22:35 ` Eric W. Biederman 2 siblings, 0 replies; 10+ messages in thread From: Eric W. Biederman @ 2002-01-05 22:35 UTC (permalink / raw) To: Alexander Viro; +Cc: Legacy Fishtank, Alan Cox, Linus Torvalds, linux-kernel Alexander Viro <viro@math.psu.edu> writes: > On Wed, 26 Dec 2001, Legacy Fishtank wrote: > > > On Wed, Dec 26, 2001 at 03:04:40PM +0000, Alan Cox wrote: > > > > Because it's small, and if it wasn't there, we'd have to have the small > > > > "rootfs" anyway (which basically duplicated ramfs functionality). > > > > > > Can ramfs=N longer term actually come back to be "use __init for the RAM > > > fs functions". That would seem to address any space issues even the most > > > embedded fanatic has. > > > > Nifty idea... We could use __rootfs or similar in the module. > > Um, folks - rootfs does _not_ go away after you mount final root over it. > Having absolute root always there makes life much simpler in a lot of > places... > > What's more, quite a few ramfs methods are good candidates for library > functions, since they are already shared with other filesystems and > number of such cases is going to grow. I guess this is o.k. Assuming we get good code sharing between ramfs/rootfs and shmfs. As those both seem to be always compiled in. Eric ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.5.2-pre2 forces ramfs on 2001-12-26 15:04 ` Alan Cox 2001-12-26 17:20 ` Legacy Fishtank @ 2001-12-26 22:04 ` Linus Torvalds 1 sibling, 0 replies; 10+ messages in thread From: Linus Torvalds @ 2001-12-26 22:04 UTC (permalink / raw) To: Alan Cox; +Cc: linux-kernel On Wed, 26 Dec 2001, Alan Cox wrote: > > Because it's small, and if it wasn't there, we'd have to have the small > > "rootfs" anyway (which basically duplicated ramfs functionality). > > Can ramfs=N longer term actually come back to be "use __init for the RAM > fs functions". That would seem to address any space issues even the most > embedded fanatic has. Hmm.. That might work, but at the same time I suspect that the most fanatic embedded users are actually the ones that may benefit most from ramfs in the first place. That was certainly why it came to be.. We'll see. We'll end up using ramfs for the initial init bootup (ie the "tar.gz->ramfs" stage of bootup), so making it __init may not be practical for other reasons. We'd have to unload it not after the __init stage, but after the first root filesystem is unused (which may be later, depending on what people put in the filesystem). Linus ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.5.2-pre2 forces ramfs on 2001-12-26 3:41 2.5.2-pre2 forces ramfs on Keith Owens 2001-12-26 4:17 ` Linus Torvalds @ 2001-12-26 4:26 ` Alexander Viro 1 sibling, 0 replies; 10+ messages in thread From: Alexander Viro @ 2001-12-26 4:26 UTC (permalink / raw) To: Keith Owens; +Cc: linux-kernel On Wed, 26 Dec 2001, Keith Owens wrote: > Index: 2-pre1.1/fs/Config.in > --- 2-pre1.1/fs/Config.in Sat, 24 Nov 2001 05:28:08 +1100 kaos (linux-2.5/F/d/27_Config.in 1.1 644) > +++ 2-pre2.1/fs/Config.in Wed, 26 Dec 2001 14:32:39 +1100 kaos (linux-2.5/F/d/27_Config.in 1.2 644) > @@ -45,7 +45,7 @@ if [ "$CONFIG_JFFS2_FS" = "y" -o "$CONFI > fi > tristate 'Compressed ROM file system support' CONFIG_CRAMFS > bool 'Virtual memory file system support (former shm fs)' CONFIG_TMPFS > -tristate 'Simple RAM-based file system support' CONFIG_RAMFS > +define_bool CONFIG_RAMFS y > > Why is ramfs forced on? Because it's always used for rootfs - notice a bunch of crap disappearing from the end of fs/namespace.c. In principle, we can keep the config item and make the first DECLARE_FSTYPE in ramfs/inode.c conditional, but that will only make ramfs invisible - code still needs to be compiled in. > And why is Al Viro's email address not in CREDITS or MAINTAINERS? We > should have somewhere to complain to ;). <shrug> I _do_ read l-k. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-01-05 22:37 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2001-12-26 3:41 2.5.2-pre2 forces ramfs on Keith Owens 2001-12-26 4:17 ` Linus Torvalds 2001-12-26 15:04 ` Alan Cox 2001-12-26 17:20 ` Legacy Fishtank 2001-12-26 17:36 ` Alexander Viro 2001-12-26 17:52 ` Legacy Fishtank 2001-12-27 10:39 ` Christoph Rohland 2002-01-05 22:35 ` Eric W. Biederman 2001-12-26 22:04 ` Linus Torvalds 2001-12-26 4:26 ` Alexander Viro
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox