Add basic superblock and inode handling routines for OMFS
Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
fs/omfs/inode.c | 439 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 439 insertions(+), 0 deletions(-)
create mode 100644 fs/omfs/inode.cdiff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
new file mode 100644
index 0000000..92d794f
--- /dev/null
+++ b/fs/omfs/inode.c
@@ -0,0 +1,439 @@
+/*
+ * Optimized MPEG FS - inode and super operations.
+ * Copyright (C) 2006 Bob Copeland <me@bobcopeland.com>
+ * Released under GPL v2.
+ */
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/fs.h>
+#include <linux/vfs.h>
+#include <linux/buffer_head.h>
+#include <linux/vmalloc.h>
+#include "omfs.h"
+
+MODULE_AUTHOR("Bob Copeland <me@bobcopeland.com>");
+MODULE_DESCRIPTION("OMFS (ReplayTV/Karma) Filesystem for Linux");
+MODULE_LICENSE("GPL");
+
+struct inode *omfs_new_inode(struct inode *dir, int mode)
+{
+ struct inode *inode;
+ u64 new_block;
+ int res;
+ int len;
+ struct omfs_sb_info *sbi = OMFS_SB(dir->i_sb);
+
+ inode = new_inode(dir->i_sb);
+ if (!inode)
+ return ERR_PTR(-ENOMEM);
+
+ res = omfs_allocate_range(dir->i_sb, sbi->s_mirrors, sbi->s_mirrors,
+ &new_block, &len);
+ if (res)
+ return ERR_PTR(res);
+
+ inode->i_ino = new_block;
+ inode->i_mode = mode;
+ inode->i_uid = current->fsuid;
+ inode->i_gid = current->fsgid;
+ inode->i_blocks = 0;
+ inode->i_mapping->a_ops = &omfs_aops;
+
+ inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ switch (mode & S_IFMT) {
+ case S_IFDIR:
+ inode->i_op = &omfs_dir_inops;
+ inode->i_fop = &omfs_dir_operations;
+ inode->i_size = sbi->s_sys_blocksize;
+ inode->i_nlink++;
+ break;
+ case S_IFREG:
+ inode->i_op = &omfs_file_inops;
+ inode->i_fop ...
can be omfs_sb->s_magic != cpu_to_be32(OMFS_MAGIC)
this code leaks omfs_sbi_info (sbi)
--
Yup, I saw that too. I dropped these and added the labels per Miklos'
This one I'm not seeing. FS core calls put_super if ret is nonzero so
this should be ok?Thanks!
--
Bob Copeland %% www.bobcopeland.com--
Yep, you are right. Sorry for the noise.
I was mislead by other filesystems code.Marcin
--
Hmm, looks like error handling needs a makeover if this is really to
become example code. See comments inline.Somebody said this is fun? Please do a proper review of this patchset
then, thank you. ("Political" eh? Now I think *that* is really
insulting to Andrew)This form is preferred:
ret = -EIO;
if (!bh)Ditto. If err is the same as assigned previously it doesn't need to
Should be:
if (!bh)
goto iget_failed;
...iget_failed:
iget_failed(inode);This is weird. This should be done by jumping to the proper label
--
It was - if sync fails, it should still try writing the mirrors. Plus
Hrm, brelse(NULL) is allowed so the check is suspect anyway. I did
this in a couple of other places, so I'll fix those up too.Thanks!
--
Bob Copeland %% www.bobcopeland.com
--
Several of these look like they should be checked before use elsewhere in
the code (eg blocksize is fed into shifts later)--
This if check is no needed, as your fill_super method never returns
success without setting it up.--
| KOSAKI Motohiro | [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Faik Uygur | Re: Linux 2.6.21-rc1 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Trent Piepho | [PATCH] [POWERPC] Improve (in|out)_beXX() asm code |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Jens Axboe | Re: [BUG] New Kernel Bugs |
