On 2012-12-06 16:56, NeilBrown wrote:
I plan to try it sometime in the next few week.

Cool!

No partitions means you need to have x-loader, uboot, and kernel in the
NAND.  That isn't difficult but it something to be aware of.

As you say, no problem. We already have our bootloader, kernel, and rootfs in NAND and I was already planning to not use a partition.

If you post the patch I can have a look and see if anything obvious stands
out.

Here it is. It's against 2.6.34, not 2.6.39, because that's what we happen to be using in our GTA02s in the field, but it probably wouldn't be much different for 2.6.39. Also, it's against the very first version of f2fs that was posted to lkml. I'm planning to redo it to integrate the latest version of f2fs.

Thanks for your feedback. I'll look forward to your 3.7 work for GTA04, and for GTA02 I'll try to get my backport working.

-v
>From f50b49a4c40a02882eff1455600ddda571814e56 Mon Sep 17 00:00:00 2001
From: Phil Vandry <van...@tzone.org>
Date: Sat, 10 Nov 2012 22:05:51 -0500
Subject: backport f2fs to kernel 2.6.34

---
 fs/f2fs/acl.c     |   61 ++++++++++++++++++++------
 fs/f2fs/acl.h     |    2 +-
 fs/f2fs/data.c    |    4 +-
 fs/f2fs/dir.c     |   30 ++++++------
 fs/f2fs/f2fs.h    |    5 +-
 fs/f2fs/file.c    |  123 +++++++++++++----------------------------------------
 fs/f2fs/gc.h      |    2 +-
 fs/f2fs/inode.c   |    6 +--
 fs/f2fs/namei.c   |   14 +++---
 fs/f2fs/node.c    |    8 ++--
 fs/f2fs/segment.c |   15 ++++--
 fs/f2fs/super.c   |   24 ++++------
 fs/f2fs/xattr.c   |    6 +-
 fs/f2fs/xattr.h   |   10 ++--
 14 files changed, 139 insertions(+), 171 deletions(-)

diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index ce661ae..bc58644 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -190,6 +190,23 @@ struct posix_acl *f2fs_get_acl(struct inode *inode, int type)
 	return acl;
 }
 
+int
+f2fs_check_acl(struct inode *inode, int mask)
+{
+	struct posix_acl *acl;
+
+	acl = f2fs_get_acl(inode, ACL_TYPE_ACCESS);
+	if (IS_ERR(acl))
+		return PTR_ERR(acl);
+	if (acl) {
+		int error = posix_acl_permission(inode, acl, mask);
+		posix_acl_release(acl);
+		return error;
+	}
+
+	return -EAGAIN;
+}
+
 static int f2fs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 {
 	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
@@ -208,9 +225,11 @@ static int f2fs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 	case ACL_TYPE_ACCESS:
 		name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
 		if (acl) {
-			error = posix_acl_equiv_mode(acl, &inode->i_mode);
+			mode_t mode = inode->i_mode;
+			error = posix_acl_equiv_mode(acl, &mode);
 			if (error < 0)
 				return error;
+			inode->i_mode = mode;
 			set_acl_inode(fi, inode->i_mode);
 			if (error == 0)
 				acl = NULL;
@@ -262,17 +281,28 @@ int f2fs_init_acl(struct inode *inode, struct inode *dir)
 	}
 
 	if (test_opt(sbi, POSIX_ACL) && acl) {
+		struct posix_acl *clone;
+		mode_t mode;
 
 		if (S_ISDIR(inode->i_mode)) {
 			error = f2fs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
 			if (error)
 				goto cleanup;
 		}
-		error = posix_acl_create(&acl, GFP_KERNEL, &inode->i_mode);
-		if (error < 0)
-			return error;
-		if (error > 0)
-			error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl);
+		clone = posix_acl_clone(acl, GFP_KERNEL);
+		error = -ENOMEM;
+		if (!clone)
+			goto cleanup;
+		mode = inode->i_mode;
+		error = posix_acl_create_masq(clone, &mode);
+		if (error >= 0) {
+			inode->i_mode = mode;
+			if (error > 0) {
+				/* This is an extended ACL */
+				error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, clone);
+			}
+		}
+		posix_acl_release(clone);
 	}
 cleanup:
 	posix_acl_release(acl);
@@ -282,7 +312,7 @@ cleanup:
 int f2fs_acl_chmod(struct inode *inode)
 {
 	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
-	struct posix_acl *acl;
+	struct posix_acl *acl, *clone;
 	int error;
 	mode_t mode = get_inode_mode(inode);
 
@@ -295,11 +325,14 @@ int f2fs_acl_chmod(struct inode *inode)
 	if (IS_ERR(acl) || !acl)
 		return PTR_ERR(acl);
 
-	error = posix_acl_chmod(&acl, GFP_KERNEL, mode);
-	if (error)
-		return error;
-	error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl);
+	clone = posix_acl_clone(acl, GFP_KERNEL);
 	posix_acl_release(acl);
+	if (!clone)
+		return -ENOMEM;
+	error = posix_acl_chmod_masq(clone, inode->i_mode);
+	if (!error)
+		error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl);
+	posix_acl_release(clone);
 	return error;
 }
 
@@ -362,7 +395,7 @@ static int f2fs_xattr_set_acl(struct dentry *dentry, const char *name,
 	if (strcmp(name, "") != 0)
 		return -EINVAL;
 
-	if (!inode_owner_or_capable(inode))
+	if (!is_owner_or_cap(inode))
 		return -EPERM;
 
 	if (value) {
@@ -385,7 +418,7 @@ release_and_out:
 	return error;
 }
 
-const struct xattr_handler f2fs_xattr_acl_default_handler = {
+struct xattr_handler f2fs_xattr_acl_default_handler = {
 	.prefix = POSIX_ACL_XATTR_DEFAULT,
 	.flags = ACL_TYPE_DEFAULT,
 	.list = f2fs_xattr_list_acl,
@@ -393,7 +426,7 @@ const struct xattr_handler f2fs_xattr_acl_default_handler = {
 	.set = f2fs_xattr_set_acl,
 };
 
-const struct xattr_handler f2fs_xattr_acl_access_handler = {
+struct xattr_handler f2fs_xattr_acl_access_handler = {
 	.prefix = POSIX_ACL_XATTR_ACCESS,
 	.flags = ACL_TYPE_ACCESS,
 	.list = f2fs_xattr_list_acl,
diff --git a/fs/f2fs/acl.h b/fs/f2fs/acl.h
index 336ec0c..369b4ff 100644
--- a/fs/f2fs/acl.h
+++ b/fs/f2fs/acl.h
@@ -36,7 +36,7 @@ struct f2fs_acl_header {
 
 #ifdef CONFIG_F2FS_FS_POSIX_ACL
 
-extern struct posix_acl *f2fs_get_acl(struct inode *inode, int type);
+extern int f2fs_check_acl(struct inode *inode, int type);
 extern int f2fs_acl_chmod(struct inode *inode);
 extern int f2fs_init_acl(struct inode *inode, struct inode *dir);
 #else
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 0cb9126..bd187d0 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -651,8 +651,8 @@ static ssize_t f2fs_direct_IO(int rw, struct kiocb *iocb,
 		return 0;
 
 	/* Needs synchronization with the cleaner */
-	return blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
-						  get_data_block_ro);
+	return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, offset, nr_segs,
+						  get_data_block_ro, NULL);
 }
 
 static void f2fs_invalidate_data_page(struct page *page, unsigned long offset)
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 51f895f..487642c 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -95,7 +95,7 @@ static struct f2fs_dir_entry *find_in_block(struct page *dentry_page,
 	struct f2fs_dentry_block *dentry_blk = kmap(dentry_page);
 	int slots;
 
-	bit_pos = find_next_bit_le(&dentry_blk->dentry_bitmap,
+	bit_pos = ext2_find_next_bit(&dentry_blk->dentry_bitmap,
 					NR_DENTRY_IN_BLOCK, 0);
 	while (bit_pos < NR_DENTRY_IN_BLOCK) {
 		de = &dentry_blk->dentry[bit_pos];
@@ -110,7 +110,7 @@ static struct f2fs_dir_entry *find_in_block(struct page *dentry_page,
 			}
 		}
 		next_pos = bit_pos + slots;
-		bit_pos = find_next_bit_le(&dentry_blk->dentry_bitmap,
+		bit_pos = ext2_find_next_bit(&dentry_blk->dentry_bitmap,
 				NR_DENTRY_IN_BLOCK, next_pos);
 		if (bit_pos >= NR_DENTRY_IN_BLOCK)
 			end_pos = NR_DENTRY_IN_BLOCK;
@@ -333,13 +333,13 @@ static int room_for_filename(struct f2fs_dentry_block *dentry_blk, int slots)
 	int bit_start = 0;
 	int zero_start, zero_end;
 next:
-	zero_start = find_next_zero_bit_le(&dentry_blk->dentry_bitmap,
+	zero_start = ext2_find_next_zero_bit(&dentry_blk->dentry_bitmap,
 						NR_DENTRY_IN_BLOCK,
 						bit_start);
 	if (zero_start >= NR_DENTRY_IN_BLOCK)
 		return NR_DENTRY_IN_BLOCK;
 
-	zero_end = find_next_bit_le(&dentry_blk->dentry_bitmap,
+	zero_end = ext2_find_next_bit(&dentry_blk->dentry_bitmap,
 						NR_DENTRY_IN_BLOCK,
 						zero_start);
 	if (zero_end - zero_start >= slots)
@@ -427,7 +427,7 @@ add_dentry:
 	de->ino = cpu_to_le32(inode->i_ino);
 	set_de_type(de, inode);
 	for (i = 0; i < slots; i++)
-		test_and_set_bit_le(bit_pos + i, &dentry_blk->dentry_bitmap);
+		ext2_set_bit(bit_pos + i, &dentry_blk->dentry_bitmap);
 	set_page_dirty(dentry_page);
 	update_parent_metadata(dir, inode, current_depth);
 fail:
@@ -462,10 +462,10 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
 	dentry_blk = (struct f2fs_dentry_block *)kaddr;
 	bit_pos = dentry - (struct f2fs_dir_entry *)dentry_blk->dentry;
 	for (i = 0; i < slots; i++)
-		test_and_clear_bit_le(bit_pos + i, &dentry_blk->dentry_bitmap);
+		ext2_clear_bit(bit_pos + i, &dentry_blk->dentry_bitmap);
 
 	/* Let's check and deallocate this dentry page */
-	bit_pos = find_next_bit_le(&dentry_blk->dentry_bitmap,
+	bit_pos = ext2_find_next_bit(&dentry_blk->dentry_bitmap,
 			NR_DENTRY_IN_BLOCK,
 			0);
 	kunmap(page); /* kunmap - pair of f2fs_find_entry */
@@ -518,7 +518,7 @@ int f2fs_make_empty(struct inode *inode, struct inode *parent)
 	if (IS_ERR(dentry_page))
 		return PTR_ERR(dentry_page);
 
-	kaddr = kmap_atomic(dentry_page);
+	kaddr = kmap_atomic(dentry_page, KM_USER0);
 	dentry_blk = (struct f2fs_dentry_block *)kaddr;
 
 	de = &dentry_blk->dentry[0];
@@ -535,9 +535,9 @@ int f2fs_make_empty(struct inode *inode, struct inode *parent)
 	memcpy(dentry_blk->filename[1], "..", 2);
 	set_de_type(de, inode);
 
-	test_and_set_bit_le(0, &dentry_blk->dentry_bitmap);
-	test_and_set_bit_le(1, &dentry_blk->dentry_bitmap);
-	kunmap_atomic(kaddr);
+	ext2_set_bit(0, &dentry_blk->dentry_bitmap);
+	ext2_set_bit(1, &dentry_blk->dentry_bitmap);
+	kunmap_atomic(kaddr, KM_USER0);
 
 	set_page_dirty(dentry_page);
 	f2fs_put_page(dentry_page, 1);
@@ -562,16 +562,16 @@ bool f2fs_empty_dir(struct inode *dir)
 				return false;
 		}
 
-		kaddr = kmap_atomic(dentry_page);
+		kaddr = kmap_atomic(dentry_page, KM_USER0);
 		dentry_blk = (struct f2fs_dentry_block *)kaddr;
 		if (bidx == 0)
 			bit_pos = 2;
 		else
 			bit_pos = 0;
-		bit_pos = find_next_bit_le(&dentry_blk->dentry_bitmap,
+		bit_pos = ext2_find_next_bit(&dentry_blk->dentry_bitmap,
 						NR_DENTRY_IN_BLOCK,
 						bit_pos);
-		kunmap_atomic(kaddr);
+		kunmap_atomic(kaddr, KM_USER0);
 
 		f2fs_put_page(dentry_page, 1);
 
@@ -610,7 +610,7 @@ static int f2fs_readdir(struct file *file, void *dirent, filldir_t filldir)
 		dentry_blk = kmap(dentry_page);
 		while (bit_pos < NR_DENTRY_IN_BLOCK) {
 			d_type = DT_UNKNOWN;
-			bit_pos = find_next_bit_le(&dentry_blk->dentry_bitmap,
+			bit_pos = ext2_find_next_bit(&dentry_blk->dentry_bitmap,
 							NR_DENTRY_IN_BLOCK,
 							bit_pos);
 			if (bit_pos >= NR_DENTRY_IN_BLOCK)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 309bd4e..83b00e4 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -17,6 +17,7 @@
 #include <linux/version.h>
 #include <linux/slab.h>
 #include <linux/crc32.h>
+#include <linux/bio.h>
 
 /**
  * For mount options
@@ -809,7 +810,7 @@ static inline int cond_clear_inode_flag(struct f2fs_inode_info *fi, int flag)
 /**
  * file.c
  */
-int f2fs_sync_file(struct file *, loff_t, loff_t, int);
+int f2fs_sync_file(struct file *, struct dentry *, int);
 void truncate_data_blocks(struct dnode_of_data *);
 void f2fs_truncate(struct inode *);
 int f2fs_setattr(struct dentry *, struct iattr *);
@@ -824,7 +825,7 @@ struct inode *f2fs_iget_nowait(struct super_block *, unsigned long);
 struct inode *f2fs_iget(struct super_block *, unsigned long);
 void update_inode(struct inode *, struct page *);
 int f2fs_write_inode(struct inode *, struct writeback_control *);
-void f2fs_evict_inode(struct inode *);
+void f2fs_clear_inode(struct inode *);
 
 /**
  * dir.c
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 48bb9f1..399b05b 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -17,6 +17,7 @@
 #include <linux/types.h>
 #include <linux/uaccess.h>
 #include <linux/mount.h>
+#include <linux/dcache.h>
 
 #include "f2fs.h"
 #include "node.h"
@@ -105,7 +106,14 @@ static int need_to_sync_dir(struct f2fs_sb_info *sbi, struct inode *inode)
 	nid_t pino;
 
 	inode = igrab(inode);
-	dentry = d_find_any_alias(inode);
+	dentry = NULL;
+	spin_lock(&inode->i_lock);
+	if (!list_empty(&inode->i_dentry)) {
+		dentry = list_first_entry(&inode->i_dentry,
+		                          struct dentry, d_alias);
+		dget(dentry);
+	}
+	spin_unlock(&inode->i_lock);
 	if (!dentry) {
 		iput(inode);
 		return 0;
@@ -116,7 +124,7 @@ static int need_to_sync_dir(struct f2fs_sb_info *sbi, struct inode *inode)
 	return !is_checkpointed_node(sbi, pino);
 }
 
-int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
+int f2fs_sync_file(struct file *file, struct dentry *unused, int datasync)
 {
 	struct inode *inode = file->f_mapping->host;
 	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
@@ -129,10 +137,6 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 		.for_reclaim = 0,
 	};
 
-	ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
-	if (ret)
-		return ret;
-
 	mutex_lock(&inode->i_mutex);
 
 	if (inode->i_sb->s_flags & MS_RDONLY)
@@ -333,11 +337,11 @@ static void do_attr_copy(struct inode *inode, struct iattr *attr)
 	struct inode copy_inode;
 
 	dup_attr(&copy_inode, inode, NULL);
-	setattr_copy(&copy_inode, attr);
+	inode_setattr(&copy_inode, attr);
 	dup_attr(inode, &copy_inode, fi);
 }
 #else
-#define __do_attr_copy	setattr_copy
+#define __do_attr_copy	generic_setattr
 #endif
 
 int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
@@ -372,37 +376,6 @@ out_err:
 	return err;
 }
 
-const struct inode_operations f2fs_file_inode_operations = {
-	.truncate	= f2fs_truncate,
-	.getattr	= f2fs_getattr,
-	.setattr	= f2fs_setattr,
-	.get_acl	= f2fs_get_acl,
-#ifdef CONFIG_F2FS_FS_XATTR
-	.setxattr	= generic_setxattr,
-	.getxattr	= generic_getxattr,
-	.listxattr	= f2fs_listxattr,
-	.removexattr	= generic_removexattr,
-#endif
-};
-
-static void fill_zero(struct inode *inode, pgoff_t index,
-					loff_t start, loff_t len)
-{
-	struct page *page;
-
-	if (!len)
-		return;
-
-	page = get_new_data_page(inode, index, false);
-
-	if (!IS_ERR(page)) {
-		wait_on_page_writeback(page);
-		zero_user(page, start, len);
-		set_page_dirty(page);
-		f2fs_put_page(page, 1);
-	}
-}
-
 int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end)
 {
 	pgoff_t index;
@@ -430,49 +403,6 @@ int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end)
 	return 0;
 }
 
-static int punch_hole(struct inode *inode, loff_t offset, loff_t len, int mode)
-{
-	pgoff_t pg_start, pg_end;
-	loff_t off_start, off_end;
-	int ret = 0;
-
-	pg_start = ((unsigned long long) offset) >> PAGE_CACHE_SHIFT;
-	pg_end = ((unsigned long long) offset + len) >> PAGE_CACHE_SHIFT;
-
-	off_start = offset & (PAGE_CACHE_SIZE - 1);
-	off_end = (offset + len) & (PAGE_CACHE_SIZE - 1);
-
-	if (pg_start == pg_end) {
-		fill_zero(inode, pg_start, off_start,
-						off_end - off_start);
-	} else {
-		if (off_start)
-			fill_zero(inode, pg_start++, off_start,
-					PAGE_CACHE_SIZE - off_start);
-		if (off_end)
-			fill_zero(inode, pg_end, 0, off_end);
-
-		if (pg_start < pg_end) {
-			struct address_space *mapping = inode->i_mapping;
-			loff_t blk_start, blk_end;
-
-			blk_start = pg_start << PAGE_CACHE_SHIFT;
-			blk_end = pg_end << PAGE_CACHE_SHIFT;
-			truncate_inode_pages_range(mapping, blk_start,
-					blk_end - 1);
-			ret = truncate_hole(inode, pg_start, pg_end);
-		}
-	}
-
-	if (!(mode & FALLOC_FL_KEEP_SIZE) &&
-		i_size_read(inode) <= (offset + len)) {
-		i_size_write(inode, offset);
-		mark_inode_dirty(inode);
-	}
-
-	return ret;
-}
-
 static int expand_inode_data(struct inode *inode, loff_t offset,
 					loff_t len, int mode)
 {
@@ -535,25 +465,33 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
 	return ret;
 }
 
-static long f2fs_fallocate(struct file *file, int mode,
+static long f2fs_fallocate(struct inode *inode, int mode,
 				loff_t offset, loff_t len)
 {
-	struct inode *inode = file->f_path.dentry->d_inode;
 	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
 	long ret;
 
-	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
-		return -EOPNOTSUPP;
-
-	if (mode & FALLOC_FL_PUNCH_HOLE)
-		ret = punch_hole(inode, offset, len, mode);
-	else
-		ret = expand_inode_data(inode, offset, len, mode);
+	ret = expand_inode_data(inode, offset, len, mode);
 
 	f2fs_balance_fs(sbi);
 	return ret;
 }
 
+
+const struct inode_operations f2fs_file_inode_operations = {
+	.truncate	= f2fs_truncate,
+	.getattr	= f2fs_getattr,
+	.setattr	= f2fs_setattr,
+	.check_acl	= f2fs_check_acl,
+	.fallocate	= f2fs_fallocate,
+#ifdef CONFIG_F2FS_FS_XATTR
+	.setxattr	= generic_setxattr,
+	.getxattr	= generic_getxattr,
+	.listxattr	= f2fs_listxattr,
+	.removexattr	= generic_removexattr,
+#endif
+};
+
 #define F2FS_REG_FLMASK		(~(FS_DIRSYNC_FL | FS_TOPDIR_FL))
 #define F2FS_OTHER_FLMASK	(FS_NODUMP_FL | FS_NOATIME_FL)
 
@@ -586,7 +524,7 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		if (ret)
 			return ret;
 
-		if (!inode_owner_or_capable(inode)) {
+		if (!is_owner_or_cap(inode)) {
 			ret = -EACCES;
 			goto out;
 		}
@@ -636,7 +574,6 @@ const struct file_operations f2fs_file_operations = {
 	.open		= generic_file_open,
 	.mmap		= f2fs_file_mmap,
 	.fsync		= f2fs_sync_file,
-	.fallocate	= f2fs_fallocate,
 	.unlocked_ioctl	= f2fs_ioctl,
 	.splice_read	= generic_file_splice_read,
 	.splice_write	= generic_file_splice_write,
diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h
index 63d9302..99d0055 100644
--- a/fs/f2fs/gc.h
+++ b/fs/f2fs/gc.h
@@ -187,7 +187,7 @@ static inline int is_idle(struct f2fs_sb_info *sbi)
 {
 	struct block_device *bdev = sbi->sb->s_bdev;
 	struct request_queue *q = bdev_get_queue(bdev);
-	struct request_list *rl = &q->root_rl;
+	struct request_list *rl = &q->rq;
 	return !(rl->count[BLK_RW_SYNC]) && !(rl->count[BLK_RW_ASYNC]);
 }
 
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index c8c84ef..21444c5 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -89,7 +89,7 @@ static int do_read_inode(struct inode *inode)
 	inode->i_mode = le16_to_cpu(ri->i_mode);
 	inode->i_uid = le32_to_cpu(ri->i_uid);
 	inode->i_gid = le32_to_cpu(ri->i_gid);
-	set_nlink(inode, le32_to_cpu(ri->i_links));
+	inode->i_nlink = le32_to_cpu(ri->i_links);
 	inode->i_size = le64_to_cpu(ri->i_size);
 	inode->i_blocks = le64_to_cpu(ri->i_blocks);
 
@@ -230,12 +230,10 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
 /**
  * Called at the last iput() if i_nlink is zero
  */
-void f2fs_evict_inode(struct inode *inode)
+void f2fs_clear_inode(struct inode *inode)
 {
 	struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
 
-	truncate_inode_pages(&inode->i_data, 0);
-
 	if (inode->i_ino == F2FS_NODE_INO(sbi) ||
 			inode->i_ino == F2FS_META_INO(sbi))
 		goto no_delete;
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 2c4e767..8451df1 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -140,8 +140,8 @@ static inline void set_cold_file(struct inode *inode, const unsigned char *name)
 	}
 }
 
-static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
-						bool excl)
+static int f2fs_create(struct inode *dir, struct dentry *dentry, int mode,
+						struct nameidata *nd)
 {
 	struct super_block *sb = dir->i_sb;
 	struct f2fs_sb_info *sbi = F2FS_SB(sb);
@@ -216,7 +216,7 @@ out:
 }
 
 static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
-		unsigned int flags)
+		struct nameidata *nd)
 {
 	struct inode *inode = NULL;
 	struct f2fs_dir_entry *de;
@@ -308,7 +308,7 @@ out:
 	return err;
 }
 
-static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
+static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 {
 	struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
 	struct inode *inode;
@@ -361,7 +361,7 @@ static int f2fs_rmdir(struct inode *dir, struct dentry *dentry)
 }
 
 static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
-				umode_t mode, dev_t rdev)
+				int mode, dev_t rdev)
 {
 	struct super_block *sb = dir->i_sb;
 	struct f2fs_sb_info *sbi = F2FS_SB(sb);
@@ -515,7 +515,7 @@ const struct inode_operations f2fs_dir_inode_operations = {
 	.mknod		= f2fs_mknod,
 	.rename		= f2fs_rename,
 	.setattr	= f2fs_setattr,
-	.get_acl	= f2fs_get_acl,
+	.check_acl	= f2fs_check_acl,
 #ifdef CONFIG_F2FS_FS_XATTR
 	.setxattr	= generic_setxattr,
 	.getxattr	= generic_getxattr,
@@ -539,7 +539,7 @@ const struct inode_operations f2fs_symlink_inode_operations = {
 
 const struct inode_operations f2fs_special_inode_operations = {
 	.setattr        = f2fs_setattr,
-	.get_acl	= f2fs_get_acl,
+	.check_acl	= f2fs_check_acl,
 #ifdef CONFIG_F2FS_FS_XATTR
 	.setxattr       = generic_setxattr,
 	.getxattr       = generic_getxattr,
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 19eeed9..d1244bc 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1432,8 +1432,8 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
 	SetPageUptodate(ipage);
 	fill_node_footer(ipage, ino, ino, 0, true);
 
-	src = kmap_atomic(page);
-	dst = kmap_atomic(ipage);
+	src = kmap_atomic(page, KM_USER0);
+	dst = kmap_atomic(ipage, KM_USER0);
 
 	memcpy(dst, src, F2FS_INODE_SIZE);
 	rn = (struct f2fs_node *)dst;
@@ -1441,8 +1441,8 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
 	rn->i.i_blocks = 1;
 	rn->i.i_links = 1;
 	rn->i.i_xattr_nid = 0;
-	kunmap_atomic(dst);
-	kunmap_atomic(src);
+	kunmap_atomic(dst, KM_USER0);
+	kunmap_atomic(src, KM_USER0);
 
 	new_ni = old_ni;
 	new_ni.ino = ino;
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 64a5499..2191c50 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -12,6 +12,7 @@
 #include <linux/f2fs_fs.h>
 #include <linux/bio.h>
 #include <linux/blkdev.h>
+#include <linux/vmalloc.h>
 
 #include "f2fs.h"
 #include "segment.h"
@@ -678,8 +679,8 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
 	int rw = sync ? WRITE_SYNC : WRITE;
 	enum page_type btype = type > META ? META : type;
 
-	if (type >= META_FLUSH)
-		rw = WRITE_FLUSH_FUA;
+	/* if (type >= META_FLUSH)
+		rw = WRITE_FLUSH_FUA; XXX not sure what to do about this */
 
 	if (sbi->bio[btype]) {
 		struct bio_private *p = sbi->bio[btype]->bi_private;
@@ -1348,6 +1349,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
 	unsigned int sit_segs, start;
 	char *src_bitmap, *dst_bitmap;
 	unsigned int bitmap_size;
+	unsigned long size;
 
 	/* allocate memory for SIT information */
 	sit_i = kzalloc(sizeof(struct sit_info), GFP_KERNEL);
@@ -1356,9 +1358,11 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
 
 	SM_I(sbi)->sit_info = sit_i;
 
-	sit_i->sentries = vzalloc(TOTAL_SEGS(sbi) * sizeof(struct seg_entry));
+	size = TOTAL_SEGS(sbi) * sizeof(struct seg_entry);
+	sit_i->sentries = vmalloc(size);
 	if (!sit_i->sentries)
 		return -ENOMEM;
+	memset(sit_i->sentries, 0, size);
 
 	bitmap_size = f2fs_bitmap_size(TOTAL_SEGS(sbi));
 	sit_i->dirty_sentries_bitmap = kzalloc(bitmap_size, GFP_KERNEL);
@@ -1376,10 +1380,11 @@ static int build_sit_info(struct f2fs_sb_info *sbi)
 	}
 
 	if (sbi->log_segs_per_sec) {
-		sit_i->sec_entries = vzalloc(sbi->total_sections *
-					sizeof(struct sec_entry));
+		size = sbi->total_sections * sizeof(struct sec_entry);
+		sit_i->sec_entries = vmalloc(size);
 		if (!sit_i->sec_entries)
 			return -ENOMEM;
+		memset(sit_i->sec_entries, 0, size);
 	}
 
 	/* get information related with SIT */
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index e120c234..6ecef55 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -78,15 +78,9 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb)
 	return &fi->vfs_inode;
 }
 
-static void f2fs_i_callback(struct rcu_head *head)
-{
-	struct inode *inode = container_of(head, struct inode, i_rcu);
-	kmem_cache_free(f2fs_inode_cachep, F2FS_I(inode));
-}
-
 void f2fs_destroy_inode(struct inode *inode)
 {
-	call_rcu(&inode->i_rcu, f2fs_i_callback);
+	kmem_cache_free(f2fs_inode_cachep, F2FS_I(inode));
 }
 
 static void f2fs_put_super(struct super_block *sb)
@@ -158,9 +152,9 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	return 0;
 }
 
-static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
+static int f2fs_show_options(struct seq_file *seq, struct vfsmount *vfs)
 {
-	struct f2fs_sb_info *sbi = F2FS_SB(root->d_sb);
+	struct f2fs_sb_info *sbi = F2FS_SB(vfs->mnt_sb);
 
 	if (test_opt(sbi, BG_GC))
 		seq_puts(seq, ",background_gc_on");
@@ -192,7 +186,7 @@ static struct super_operations f2fs_sops = {
 	.destroy_inode	= f2fs_destroy_inode,
 	.write_inode	= f2fs_write_inode,
 	.show_options	= f2fs_show_options,
-	.evict_inode	= f2fs_evict_inode,
+	.clear_inode	= f2fs_clear_inode,
 	.put_super	= f2fs_put_super,
 	.sync_fs	= f2fs_sync_fs,
 	.statfs		= f2fs_statfs,
@@ -439,7 +433,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size)
 		goto free_root_inode;
 
-	sb->s_root = d_make_root(root); /* allocate root dentry */
+	sb->s_root = d_alloc_root(root); /* allocate root dentry */
 	if (!sb->s_root)
 		goto free_root_inode;
 
@@ -485,16 +479,16 @@ free_sbi:
 	return -EINVAL;
 }
 
-static struct dentry *f2fs_mount(struct file_system_type *fs_type, int flags,
-			const char *dev_name, void *data)
+static int f2fs_get_sb(struct file_system_type *fs_type, int flags,
+			const char *dev_name, void *data, struct vfsmount *mnt)
 {
-	return mount_bdev(fs_type, flags, dev_name, data, f2fs_fill_super);
+	return get_sb_bdev(fs_type, flags, dev_name, data, f2fs_fill_super, mnt);
 }
 
 static struct file_system_type f2fs_fs_type = {
 	.owner		= THIS_MODULE,
 	.name		= "f2fs",
-	.mount		= f2fs_mount,
+	.get_sb		= f2fs_get_sb,
 	.kill_sb	= kill_block_super,
 	.fs_flags	= FS_REQUIRES_DEV,
 };
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 3497925..0737419 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -102,7 +102,7 @@ static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
 	return f2fs_setxattr(dentry->d_inode, type, name, value, size);
 }
 
-const struct xattr_handler f2fs_xattr_user_handler = {
+struct xattr_handler f2fs_xattr_user_handler = {
 	.prefix = XATTR_USER_PREFIX,
 	.flags	= F2FS_XATTR_INDEX_USER,
 	.list   = f2fs_xattr_generic_list,
@@ -110,7 +110,7 @@ const struct xattr_handler f2fs_xattr_user_handler = {
 	.set    = f2fs_xattr_generic_set,
 };
 
-const struct xattr_handler f2fs_xattr_trusted_handler = {
+struct xattr_handler f2fs_xattr_trusted_handler = {
 	.prefix = XATTR_TRUSTED_PREFIX,
 	.flags	= F2FS_XATTR_INDEX_TRUSTED,
 	.list   = f2fs_xattr_generic_list,
@@ -127,7 +127,7 @@ static const struct xattr_handler *f2fs_xattr_handler_map[] = {
 	[F2FS_XATTR_INDEX_TRUSTED]           = &f2fs_xattr_trusted_handler,
 };
 
-const struct xattr_handler *f2fs_xattr_handlers[] = {
+struct xattr_handler *f2fs_xattr_handlers[] = {
 	&f2fs_xattr_user_handler,
 #ifdef CONFIG_F2FS_FS_POSIX_ACL
 	&f2fs_xattr_acl_access_handler,
diff --git a/fs/f2fs/xattr.h b/fs/f2fs/xattr.h
index f6c5a97..9aed064 100644
--- a/fs/f2fs/xattr.h
+++ b/fs/f2fs/xattr.h
@@ -105,12 +105,12 @@ struct f2fs_xattr_entry {
  **/
 
 #ifdef CONFIG_F2FS_FS_XATTR
-extern const struct xattr_handler f2fs_xattr_user_handler;
-extern const struct xattr_handler f2fs_xattr_trusted_handler;
-extern const struct xattr_handler f2fs_xattr_acl_access_handler;
-extern const struct xattr_handler f2fs_xattr_acl_default_handler;
+extern struct xattr_handler f2fs_xattr_user_handler;
+extern struct xattr_handler f2fs_xattr_trusted_handler;
+extern struct xattr_handler f2fs_xattr_acl_access_handler;
+extern struct xattr_handler f2fs_xattr_acl_default_handler;
 
-extern const struct xattr_handler *f2fs_xattr_handlers[];
+extern struct xattr_handler *f2fs_xattr_handlers[];
 
 extern int f2fs_setxattr(struct inode *inode, int name_index, const char *name,
 		const void *value, size_t value_len);
-- 
1.7.2.5

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community

Reply via email to