linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / fs / jffs / inode-v23.c
index 4d34ba6..fc3855a 100644 (file)
@@ -298,7 +298,7 @@ jffs_setattr(struct dentry *dentry, struct iattr *iattr)
                if (len) {
                        invalidate_inode_pages(inode->i_mapping);
                }
-               inode->i_ctime = CURRENT_TIME;
+               inode->i_ctime = CURRENT_TIME_SEC;
                inode->i_mtime = inode->i_ctime;
        }
        if (update_all || iattr->ia_valid & ATTR_ATIME) {
@@ -315,7 +315,7 @@ jffs_setattr(struct dentry *dentry, struct iattr *iattr)
        }
 
        /* Write this node to the flash.  */
-       if ((res = jffs_write_node(c, new_node, &raw_inode, f->name, 0, recoverable, f)) < 0) {
+       if ((res = jffs_write_node(c, new_node, &raw_inode, f->name, NULL, recoverable, f)) < 0) {
                D(printk("jffs_notify_change(): The write failed!\n"));
                jffs_free_node(new_node);
                D3(printk (KERN_NOTICE "n_c(): up biglock\n"));
@@ -323,7 +323,7 @@ jffs_setattr(struct dentry *dentry, struct iattr *iattr)
                goto out;
        }
 
-       jffs_insert_node(c, f, &raw_inode, 0, new_node);
+       jffs_insert_node(c, f, &raw_inode, NULL, new_node);
 
        mark_inode_dirty(inode);
        D3(printk (KERN_NOTICE "n_c(): up biglock\n"));
@@ -334,7 +334,7 @@ out:
 } /* jffs_notify_change()  */
 
 
-struct inode *
+static struct inode *
 jffs_new_inode(const struct inode * dir, struct jffs_raw_inode *raw_inode,
               int * err)
 {
@@ -376,7 +376,7 @@ jffs_new_inode(const struct inode * dir, struct jffs_raw_inode *raw_inode,
 }
 
 /* Get statistics of the file system.  */
-int
+static int
 jffs_statfs(struct super_block *sb, struct kstatfs *buf)
 {
        struct jffs_control *c = (struct jffs_control *) sb->s_fs_info;
@@ -410,7 +410,7 @@ jffs_statfs(struct super_block *sb, struct kstatfs *buf)
 
 
 /* Rename a file.  */
-int
+static int
 jffs_rename(struct inode *old_dir, struct dentry *old_dentry,
            struct inode *new_dir, struct dentry *new_dentry)
 {
@@ -548,7 +548,7 @@ jffs_rename(struct inode *old_dir, struct dentry *old_dentry,
        /* This is a kind of update of the inode we're about to make
           here.  This is what they do in ext2fs.  Kind of.  */
        if ((inode = iget(new_dir->i_sb, f->ino))) {
-               inode->i_ctime = CURRENT_TIME;
+               inode->i_ctime = CURRENT_TIME_SEC;
                mark_inode_dirty(inode);
                iput(inode);
        }
@@ -757,7 +757,7 @@ jffs_do_readpage_nolock(struct file *file, struct page *page)
 
        read_len = 0;
        result = 0;
-       offset = page->index << PAGE_CACHE_SHIFT;
+       offset = page_offset(page);
 
        kmap(page);
        buf = page_address(page);
@@ -879,14 +879,14 @@ jffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 
        /* Write the new node to the flash.  */
        if ((result = jffs_write_node(c, node, &raw_inode,
-                                     dentry->d_name.name, 0, 0, NULL)) < 0) {
+                                    dentry->d_name.name, NULL, 0, NULL)) < 0) {
                D(printk("jffs_mkdir(): jffs_write_node() failed.\n"));
                jffs_free_node(node);
                goto jffs_mkdir_end;
        }
 
        /* Insert the new node into the file system.  */
-       if ((result = jffs_insert_node(c, 0, &raw_inode, dentry->d_name.name,
+       if ((result = jffs_insert_node(c, NULL, &raw_inode, dentry->d_name.name,
                                       node)) < 0) {
                goto jffs_mkdir_end;
        }
@@ -959,7 +959,7 @@ jffs_remove(struct inode *dir, struct dentry *dentry, int type)
        struct jffs_file *dir_f; /* The file-to-remove's parent.  */
        struct jffs_file *del_f; /* The file to remove.  */
        struct jffs_node *del_node;
-       struct inode *inode = 0;
+       struct inode *inode = NULL;
        int result = 0;
 
        D1({
@@ -1041,7 +1041,7 @@ jffs_remove(struct inode *dir, struct dentry *dentry, int type)
        raw_inode.deleted = 1;
 
        /* Write the new node to the flash memory.  */
-       if (jffs_write_node(c, del_node, &raw_inode, 0, 0, 1, del_f) < 0) {
+       if (jffs_write_node(c, del_node, &raw_inode, NULL, NULL, 1, del_f) < 0) {
                jffs_free_node(del_node);
                result = -EIO;
                goto jffs_remove_end;
@@ -1049,9 +1049,9 @@ jffs_remove(struct inode *dir, struct dentry *dentry, int type)
 
        /* Update the file.  This operation will make the file disappear
           from the in-memory file system structures.  */
-       jffs_insert_node(c, del_f, &raw_inode, 0, del_node);
+       jffs_insert_node(c, del_f, &raw_inode, NULL, del_node);
 
-       dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+       dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
        mark_inode_dirty(dir);
        inode->i_nlink--;
        inode->i_ctime = dir->i_ctime;
@@ -1070,7 +1070,7 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
 {
        struct jffs_raw_inode raw_inode;
        struct jffs_file *dir_f;
-       struct jffs_node *node = 0;
+       struct jffs_node *node = NULL;
        struct jffs_control *c;
        struct inode *inode;
        int result = 0;
@@ -1127,7 +1127,7 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
        }
 
        /* Insert the new node into the file system.  */
-       if ((err = jffs_insert_node(c, 0, &raw_inode, dentry->d_name.name,
+       if ((err = jffs_insert_node(c, NULL, &raw_inode, dentry->d_name.name,
                                    node)) < 0) {
                result = err;
                goto jffs_mknod_end;
@@ -1237,7 +1237,7 @@ jffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
        }
 
        /* Insert the new node into the file system.  */
-       if ((err = jffs_insert_node(c, 0, &raw_inode, dentry->d_name.name,
+       if ((err = jffs_insert_node(c, NULL, &raw_inode, dentry->d_name.name,
                                    node)) < 0) {
                goto jffs_symlink_end;
        }
@@ -1333,14 +1333,14 @@ jffs_create(struct inode *dir, struct dentry *dentry, int mode,
 
        /* Write the new node to the flash.  */
        if ((err = jffs_write_node(c, node, &raw_inode,
-                                  dentry->d_name.name, 0, 0, NULL)) < 0) {
+                                  dentry->d_name.name, NULL, 0, NULL)) < 0) {
                D(printk("jffs_create(): jffs_write_node() failed.\n"));
                jffs_free_node(node);
                goto jffs_create_end;
        }
 
        /* Insert the new node into the file system.  */
-       if ((err = jffs_insert_node(c, 0, &raw_inode, dentry->d_name.name,
+       if ((err = jffs_insert_node(c, NULL, &raw_inode, dentry->d_name.name,
                                    node)) < 0) {
                goto jffs_create_end;
        }
@@ -1415,7 +1415,7 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
         * This will never trigger with sane page sizes.  leave it in
         * anyway, since I'm thinking about how to merge larger writes
         * (the current idea is to poke a thread that does the actual
-        * I/O and starts by doing a down(&inode->i_sem).  then we
+        * I/O and starts by doing a mutex_lock(&inode->i_mutex).  then we
         * would need to get the page cache pages and have a list of
         * I/O requests and do write-merging here.
         * -- prumpf
@@ -1501,7 +1501,7 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
                pos += err;
 
                /* Insert the new node into the file system.  */
-               if ((err = jffs_insert_node(c, f, &raw_inode, 0, node)) < 0) {
+               if ((err = jffs_insert_node(c, f, &raw_inode, NULL, node)) < 0) {
                        goto out;
                }
 
@@ -1518,7 +1518,7 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
                inode->i_size = pos;
                inode->i_blocks = (inode->i_size + 511) >> 9;
        }
-       inode->i_ctime = inode->i_mtime = CURRENT_TIME;
+       inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
        mark_inode_dirty(inode);
        invalidate_inode_pages(inode->i_mapping);
 
@@ -1545,7 +1545,7 @@ jffs_commit_write(struct file *filp, struct page *page,
 {
        void *addr = page_address(page) + from;
        /* XXX: PAGE_CACHE_SHIFT or PAGE_SHIFT */
-       loff_t pos = (page->index<<PAGE_CACHE_SHIFT) + from;
+       loff_t pos = page_offset(page) + from;
 
        return jffs_file_write(filp, addr, to-from, &pos);
 } /* jffs_commit_write() */
@@ -1629,9 +1629,6 @@ static int jffs_fsync(struct file *f, struct dentry *d, int datasync)
 }
 
 
-extern int generic_file_open(struct inode *, struct file *) __attribute__((weak));
-extern loff_t generic_file_llseek(struct file *, loff_t, int) __attribute__((weak));
-
 static struct file_operations jffs_file_operations =
 {
        .open           = generic_file_open,
@@ -1739,7 +1736,7 @@ jffs_read_inode(struct inode *inode)
 }
 
 
-void
+static void
 jffs_delete_inode(struct inode *inode)
 {
        struct jffs_file *f;
@@ -1747,10 +1744,11 @@ jffs_delete_inode(struct inode *inode)
        D3(printk("jffs_delete_inode(): inode->i_ino == %lu\n",
                  inode->i_ino));
 
+       truncate_inode_pages(&inode->i_data, 0);
        lock_kernel();
        inode->i_size = 0;
        inode->i_blocks = 0;
-       inode->u.generic_ip = 0;
+       inode->u.generic_ip = NULL;
        clear_inode(inode);
        if (inode->i_nlink == 0) {
                c = (struct jffs_control *) inode->i_sb->s_fs_info;
@@ -1762,7 +1760,7 @@ jffs_delete_inode(struct inode *inode)
 }
 
 
-void
+static void
 jffs_write_super(struct super_block *sb)
 {
        struct jffs_control *c = (struct jffs_control *)sb->s_fs_info;