From 79959d26b3613d10924e026483411be9d3f6fb4e Mon Sep 17 00:00:00 2001
From: johann <johann>
Date: Tue, 17 Jul 2007 07:15:48 +0000
Subject: [PATCH] Branch b1_6 b=11039 i=adilger i=kalpak

attachment 11245 / update ldiskfs series and the remaining patches for 2.6.18
support
---
 .../patches/ext3-map_inode_page-2.6.18.patch  |  86 +++++++++++++
 .../ext3-nanosecond-2.6.18-vanilla.patch      | 120 +++++++++---------
 .../series/ldiskfs-2.6.18-vanilla.series      |   9 +-
 3 files changed, 152 insertions(+), 63 deletions(-)
 create mode 100644 ldiskfs/kernel_patches/patches/ext3-map_inode_page-2.6.18.patch

diff --git a/ldiskfs/kernel_patches/patches/ext3-map_inode_page-2.6.18.patch b/ldiskfs/kernel_patches/patches/ext3-map_inode_page-2.6.18.patch
new file mode 100644
index 0000000000..4bde41b99e
--- /dev/null
+++ b/ldiskfs/kernel_patches/patches/ext3-map_inode_page-2.6.18.patch
@@ -0,0 +1,86 @@
+Index: linux-2.6.18.8/fs/ext3/inode.c
+===================================================================
+--- linux-2.6.18.8.orig/fs/ext3/inode.c	2007-06-20 18:10:33.000000000 +0200
++++ linux-2.6.18.8/fs/ext3/inode.c	2007-06-20 18:53:48.000000000 +0200
+@@ -3222,3 +3222,66 @@ int ext3_change_inode_journal_flag(struc
+ 
+ 	return err;
+ }
++
++int ext3_map_inode_page(struct inode *inode, struct page *page,
++			unsigned long *blocks, int *created, int create)
++{
++	unsigned int blocksize, blocks_per_page;
++	unsigned long iblock;
++	struct buffer_head dummy;
++	void *handle;
++	int i, rc = 0, failed = 0, needed_blocks;
++
++	blocksize = inode->i_sb->s_blocksize;
++	blocks_per_page = PAGE_SIZE >> inode->i_sb->s_blocksize_bits;
++	iblock = page->index * blocks_per_page;
++
++	for (i = 0; i < blocks_per_page; i++, iblock++) {
++		blocks[i] = ext3_bmap(inode->i_mapping, iblock);
++		if (blocks[i] == 0) {
++			failed++;
++			if (created)
++				created[i] = -1;
++		} else if (created) {
++			created[i] = 0;
++		}
++	}
++
++	if (failed == 0 || create == 0)
++		return 0;
++
++	needed_blocks = ext3_writepage_trans_blocks(inode);
++	handle = ext3_journal_start(inode, needed_blocks);
++	if (IS_ERR(handle))
++		return PTR_ERR(handle);
++
++	iblock = page->index * blocks_per_page;
++	for (i = 0; i < blocks_per_page; i++, iblock++) {
++		if (blocks[i] != 0)
++			continue;
++
++		rc = ext3_get_blocks_handle(handle, inode, iblock, 1, &dummy, 1, 1);
++		if (rc < 0) {
++			printk(KERN_INFO "ext3_map_inode_page: error reading "
++					"block %ld\n", iblock);
++			goto out;
++		} else {
++			if (rc > 1)
++				WARN_ON(1);
++			rc = 0;
++		}
++		/* Unmap any metadata buffers from the block mapping, to avoid
++		 * data corruption due to direct-write from Lustre being
++		 * clobbered by a later flush of the blockdev metadata buffer.*/
++		if (buffer_new(&dummy))
++			unmap_underlying_metadata(dummy.b_bdev,
++					dummy.b_blocknr);
++		blocks[i] = dummy.b_blocknr;
++		if (created)
++			created[i] = 1;
++	}
++
++out:
++	ext3_journal_stop(handle);
++	return rc;
++}
+Index: linux-2.6.18.8/fs/ext3/super.c
+===================================================================
+--- linux-2.6.18.8.orig/fs/ext3/super.c	2007-06-20 18:10:33.000000000 +0200
++++ linux-2.6.18.8/fs/ext3/super.c	2007-06-20 18:51:12.000000000 +0200
+@@ -2765,6 +2765,10 @@ static void __exit exit_ext3_fs(void)
+ 	exit_ext3_xattr();
+ }
+ 
++int ext3_map_inode_page(struct inode *inode, struct page *page,
++			unsigned long *blocks, int *created, int create);
++EXPORT_SYMBOL(ext3_map_inode_page);
++
+ MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
+ MODULE_DESCRIPTION("Second Extended Filesystem with journaling extensions");
+ MODULE_LICENSE("GPL");
diff --git a/ldiskfs/kernel_patches/patches/ext3-nanosecond-2.6.18-vanilla.patch b/ldiskfs/kernel_patches/patches/ext3-nanosecond-2.6.18-vanilla.patch
index 6dd7ad76d6..922481c00b 100644
--- a/ldiskfs/kernel_patches/patches/ext3-nanosecond-2.6.18-vanilla.patch
+++ b/ldiskfs/kernel_patches/patches/ext3-nanosecond-2.6.18-vanilla.patch
@@ -1,8 +1,8 @@
-Index: linux-2.6.18/fs/ext3/ialloc.c
+Index: linux-2.6.18.8/fs/ext3/ialloc.c
 ===================================================================
---- linux-2.6.18.orig/fs/ext3/ialloc.c
-+++ linux-2.6.18/fs/ext3/ialloc.c
-@@ -615,7 +615,8 @@ got:
+--- linux-2.6.18.8.orig/fs/ext3/ialloc.c	2007-06-20 18:54:59.000000000 +0200
++++ linux-2.6.18.8/fs/ext3/ialloc.c	2007-06-20 18:54:59.000000000 +0200
+@@ -729,7 +729,8 @@ got:
  	/* This is the optimal IO size (for stat), not the fs block size */
  	inode->i_blksize = PAGE_SIZE;
  	inode->i_blocks = 0;
@@ -12,7 +12,7 @@ Index: linux-2.6.18/fs/ext3/ialloc.c
  
  	memset(ei->i_data, 0, sizeof(ei->i_data));
  	ei->i_dir_start_lookup = 0;
-@@ -647,9 +648,8 @@ got:
+@@ -761,9 +762,8 @@ got:
  	spin_unlock(&sbi->s_next_gen_lock);
  
  	ei->i_state = EXT3_STATE_NEW;
@@ -24,11 +24,11 @@ Index: linux-2.6.18/fs/ext3/ialloc.c
  
  	ret = inode;
  	if(DQUOT_ALLOC_INODE(inode)) {
-Index: linux-2.6.18/fs/ext3/inode.c
+Index: linux-2.6.18.8/fs/ext3/inode.c
 ===================================================================
---- linux-2.6.18.orig/fs/ext3/inode.c
-+++ linux-2.6.18/fs/ext3/inode.c
-@@ -729,7 +729,7 @@ static int ext3_splice_branch(handle_t *
+--- linux-2.6.18.8.orig/fs/ext3/inode.c	2007-06-20 18:54:52.000000000 +0200
++++ linux-2.6.18.8/fs/ext3/inode.c	2007-06-20 18:54:59.000000000 +0200
+@@ -727,7 +727,7 @@ static int ext3_splice_branch(handle_t *
  
  	/* We are done with atomic stuff, now do the rest of housekeeping */
  
@@ -37,7 +37,7 @@ Index: linux-2.6.18/fs/ext3/inode.c
  	ext3_mark_inode_dirty(handle, inode);
  
  	/* had we spliced it onto indirect block? */
-@@ -2388,7 +2388,7 @@ do_indirects:
+@@ -2375,7 +2375,7 @@ do_indirects:
  	ext3_discard_reservation(inode);
  
  	mutex_unlock(&ei->truncate_mutex);
@@ -46,7 +46,7 @@ Index: linux-2.6.18/fs/ext3/inode.c
  	ext3_mark_inode_dirty(handle, inode);
  
  	/*
-@@ -2624,10 +2624,6 @@ void ext3_read_inode(struct inode * inod
+@@ -2611,10 +2611,6 @@ void ext3_read_inode(struct inode * inod
  	}
  	inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
  	inode->i_size = le32_to_cpu(raw_inode->i_size);
@@ -57,7 +57,7 @@ Index: linux-2.6.18/fs/ext3/inode.c
  
  	ei->i_state = 0;
  	ei->i_dir_start_lookup = 0;
-@@ -2702,6 +2698,11 @@ void ext3_read_inode(struct inode * inod
+@@ -2689,6 +2685,11 @@ void ext3_read_inode(struct inode * inod
  	} else
  		ei->i_extra_isize = 0;
  
@@ -69,7 +69,7 @@ Index: linux-2.6.18/fs/ext3/inode.c
  	if (S_ISREG(inode->i_mode)) {
  		inode->i_op = &ext3_file_inode_operations;
  		inode->i_fop = &ext3_file_operations;
-@@ -2782,9 +2783,12 @@ static int ext3_do_update_inode(handle_t
+@@ -2769,9 +2770,12 @@ static int ext3_do_update_inode(handle_t
  	}
  	raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
  	raw_inode->i_size = cpu_to_le32(ei->i_disksize);
@@ -85,10 +85,10 @@ Index: linux-2.6.18/fs/ext3/inode.c
  	raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
  	raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
  	raw_inode->i_flags = cpu_to_le32(ei->i_flags);
-Index: linux-2.6.18/fs/ext3/ioctl.c
+Index: linux-2.6.18.8/fs/ext3/ioctl.c
 ===================================================================
---- linux-2.6.18.orig/fs/ext3/ioctl.c
-+++ linux-2.6.18/fs/ext3/ioctl.c
+--- linux-2.6.18.8.orig/fs/ext3/ioctl.c	2007-06-20 18:42:05.000000000 +0200
++++ linux-2.6.18.8/fs/ext3/ioctl.c	2007-06-20 18:54:59.000000000 +0200
 @@ -120,7 +120,7 @@ int ext3_ioctl (struct inode * inode, st
  		ei->i_flags = flags;
  
@@ -98,7 +98,7 @@ Index: linux-2.6.18/fs/ext3/ioctl.c
  
  		err = ext3_mark_iloc_dirty(handle, inode, &iloc);
  flags_err:
-@@ -161,7 +161,7 @@ flags_err:
+@@ -157,7 +157,7 @@ flags_err:
  			return PTR_ERR(handle);
  		err = ext3_reserve_inode_write(handle, inode, &iloc);
  		if (err == 0) {
@@ -107,10 +107,10 @@ Index: linux-2.6.18/fs/ext3/ioctl.c
  			inode->i_generation = generation;
  			err = ext3_mark_iloc_dirty(handle, inode, &iloc);
  		}
-Index: linux-2.6.18/fs/ext3/namei.c
+Index: linux-2.6.18.8/fs/ext3/namei.c
 ===================================================================
---- linux-2.6.18.orig/fs/ext3/namei.c
-+++ linux-2.6.18/fs/ext3/namei.c
+--- linux-2.6.18.8.orig/fs/ext3/namei.c	2007-06-20 18:54:53.000000000 +0200
++++ linux-2.6.18.8/fs/ext3/namei.c	2007-06-20 18:54:59.000000000 +0200
 @@ -1287,7 +1287,7 @@ static int add_dirent_to_buf(handle_t *h
  	 * happen is that the times are slightly out of date
  	 * and/or different from the directory change time.
@@ -175,11 +175,11 @@ Index: linux-2.6.18/fs/ext3/namei.c
  	ext3_update_dx_flag(old_dir);
  	if (dir_bh) {
  		BUFFER_TRACE(dir_bh, "get_write_access");
-Index: linux-2.6.18/fs/ext3/super.c
+Index: linux-2.6.18.8/fs/ext3/super.c
 ===================================================================
---- linux-2.6.18.orig/fs/ext3/super.c
-+++ linux-2.6.18/fs/ext3/super.c
-@@ -1615,6 +1615,8 @@ static int ext3_fill_super (struct super
+--- linux-2.6.18.8.orig/fs/ext3/super.c	2007-06-20 18:54:59.000000000 +0200
++++ linux-2.6.18.8/fs/ext3/super.c	2007-06-20 18:54:59.000000000 +0200
+@@ -1713,6 +1713,8 @@ static int ext3_fill_super (struct super
  				sbi->s_inode_size);
  			goto failed_mount;
  		}
@@ -188,7 +188,7 @@ Index: linux-2.6.18/fs/ext3/super.c
  	}
  	sbi->s_frag_size = EXT3_MIN_FRAG_SIZE <<
  				   le32_to_cpu(es->s_log_frag_size);
-@@ -1819,6 +1821,32 @@ static int ext3_fill_super (struct super
+@@ -1917,6 +1919,32 @@ static int ext3_fill_super (struct super
  	}
  
  	ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
@@ -221,10 +221,10 @@ Index: linux-2.6.18/fs/ext3/super.c
  	/*
  	 * akpm: core read_super() calls in here with the superblock locked.
  	 * That deadlocks, because orphan cleanup needs to lock the superblock
-Index: linux-2.6.18/fs/ext3/xattr.c
+Index: linux-2.6.18.8/fs/ext3/xattr.c
 ===================================================================
---- linux-2.6.18.orig/fs/ext3/xattr.c
-+++ linux-2.6.18/fs/ext3/xattr.c
+--- linux-2.6.18.8.orig/fs/ext3/xattr.c	2007-06-20 18:54:52.000000000 +0200
++++ linux-2.6.18.8/fs/ext3/xattr.c	2007-06-20 18:54:59.000000000 +0200
 @@ -1007,7 +1007,7 @@ ext3_xattr_set_handle(handle_t *handle, 
  	}
  	if (!error) {
@@ -234,11 +234,11 @@ Index: linux-2.6.18/fs/ext3/xattr.c
  		error = ext3_mark_iloc_dirty(handle, inode, &is.iloc);
  		/*
  		 * The bh is consumed by ext3_mark_iloc_dirty, even with
-Index: linux-2.6.18/include/linux/ext3_fs.h
+Index: linux-2.6.18.8/include/linux/ext3_fs.h
 ===================================================================
---- linux-2.6.18.orig/include/linux/ext3_fs.h
-+++ linux-2.6.18/include/linux/ext3_fs.h
-@@ -268,7 +268,7 @@ struct ext3_inode {
+--- linux-2.6.18.8.orig/include/linux/ext3_fs.h	2007-06-20 18:54:59.000000000 +0200
++++ linux-2.6.18.8/include/linux/ext3_fs.h	2007-06-20 18:54:59.000000000 +0200
+@@ -288,7 +288,7 @@ struct ext3_inode {
  	__le16	i_uid;		/* Low 16 bits of Owner Uid */
  	__le32	i_size;		/* Size in bytes */
  	__le32	i_atime;	/* Access time */
@@ -247,7 +247,7 @@ Index: linux-2.6.18/include/linux/ext3_fs.h
  	__le32	i_mtime;	/* Modification time */
  	__le32	i_dtime;	/* Deletion Time */
  	__le16	i_gid;		/* Low 16 bits of Group Id */
-@@ -317,10 +317,73 @@ struct ext3_inode {
+@@ -337,10 +337,73 @@ struct ext3_inode {
  	} osd2;				/* OS dependent 2 */
  	__le16	i_extra_isize;
  	__le16	i_pad1;
@@ -321,7 +321,7 @@ Index: linux-2.6.18/include/linux/ext3_fs.h
  #if defined(__KERNEL__) || defined(__linux__)
  #define i_reserved1	osd1.linux1.l_i_reserved1
  #define i_frag		osd2.linux2.l_i_frag
-@@ -498,11 +562,19 @@ struct ext3_super_block {
+@@ -520,11 +583,19 @@ struct ext3_super_block {
  	__le32	s_last_orphan;		/* start of list of inodes to delete */
  	__le32	s_hash_seed[4];		/* HTREE hash seed */
  	__u8	s_def_hash_version;	/* Default hash version to use */
@@ -345,7 +345,7 @@ Index: linux-2.6.18/include/linux/ext3_fs.h
  };
  
  #ifdef __KERNEL__
-@@ -519,6 +584,13 @@ static inline struct ext3_inode_info *EX
+@@ -539,6 +610,13 @@ static inline struct ext3_inode_info *EX
  	return container_of(inode, struct ext3_inode_info, vfs_inode);
  }
  
@@ -359,45 +359,47 @@ Index: linux-2.6.18/include/linux/ext3_fs.h
  static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
  {
  	return ino == EXT3_ROOT_INO ||
-@@ -590,6 +662,8 @@ static inline int ext3_valid_inum(struct
- #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE	0x0002
+@@ -611,6 +689,8 @@ static inline int ext3_valid_inum(struct
  #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR	0x0004
+ #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM		0x0010
  #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK	0x0020
 +#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE	0x0040
 +
  
  #define EXT3_FEATURE_INCOMPAT_COMPRESSION	0x0001
  #define EXT3_FEATURE_INCOMPAT_FILETYPE		0x0002
-@@ -606,6 +680,7 @@ static inline int ext3_valid_inum(struct
- #define EXT3_FEATURE_RO_COMPAT_SUPP	(EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
+@@ -628,6 +708,7 @@ static inline int ext3_valid_inum(struct
  					 EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
+ 					 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
  					 EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
 +					 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE| \
  					 EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
  
  /*
-Index: linux-2.6.18/include/linux/ext3_fs_sb.h
+Index: linux-2.6.18.8/include/linux/ext3_fs_sb.h
 ===================================================================
---- linux-2.6.18.orig/include/linux/ext3_fs_sb.h
-+++ linux-2.6.18/include/linux/ext3_fs_sb.h
-@@ -119,6 +119,8 @@ struct ext3_sb_info {
- 	spinlock_t s_bal_lock;
- 	unsigned long s_mb_buddies_generated;
- 	unsigned long long s_mb_generation_time;
-+
-+	unsigned int  s_want_extra_isize;	/* New inodes should reserve # bytes */
- };
+--- linux-2.6.18.8.orig/include/linux/ext3_fs_sb.h	2007-06-20 18:54:54.000000000 +0200
++++ linux-2.6.18.8/include/linux/ext3_fs_sb.h	2007-06-20 18:54:59.000000000 +0200
+@@ -68,6 +68,9 @@ struct ext3_sb_info {
+ 	/* Last group used to allocate inode */
+ 	int s_last_alloc_group;
  
- #define EXT3_GROUP_INFO(sb, group)					   \
-Index: linux-2.6.18/include/linux/ext3_fs_i.h
++	/* New inodes should reserve # bytes */
++	unsigned int  s_want_extra_isize;
++
+ 	/* root of the per fs reservation window tree */
+ 	spinlock_t s_rsv_window_lock;
+ 	struct rb_root s_rsv_window_root;
+Index: linux-2.6.18.8/include/linux/ext3_fs_i.h
 ===================================================================
---- linux-2.6.18.orig/include/linux/ext3_fs_i.h
-+++ linux-2.6.18/include/linux/ext3_fs_i.h
-@@ -144,6 +144,7 @@ struct ext3_inode_info {
- 	struct inode vfs_inode;
+--- linux-2.6.18.8.orig/include/linux/ext3_fs_i.h	2007-06-20 18:54:57.000000000 +0200
++++ linux-2.6.18.8/include/linux/ext3_fs_i.h	2007-06-20 18:54:59.000000000 +0200
+@@ -140,6 +140,8 @@ struct ext3_inode_info {
+ 	/* on-disk additional length */
+ 	__u16 i_extra_isize;
  
- 	__u32 i_cached_extent[4];
 +	struct timespec i_crtime;
- 
- 	void *i_filterdata;
- };
++
+ 	/*
+ 	 * truncate_mutex is for serialising ext3_truncate() against
+ 	 * ext3_getblock().  In the 2.4 ext2 design, great chunks of inode's
diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6.18-vanilla.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6.18-vanilla.series
index 350067db39..3fc9e90753 100644
--- a/ldiskfs/kernel_patches/series/ldiskfs-2.6.18-vanilla.series
+++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6.18-vanilla.series
@@ -1,14 +1,15 @@
 ext3-wantedi-2.6-rhel4.patch
-ext3-san-jdike-2.6-suse.patch
 iopen-2.6-fc5.patch
-ext3-map_inode_page-2.6-suse.patch
+ext3-map_inode_page-2.6.18.patch
 export-ext3-2.6-rhel4.patch
 ext3-include-fixes-2.6-rhel4.patch
 ext3-extents-2.6.18-vanilla.patch
-ext3-mballoc2-2.6.18-vanilla.patch
+ext3-mballoc3-core.patch
+ext3-mballoc3-2.6.18.patch
 ext3-nlinks-2.6.9.patch
 ext3-ialloc-2.6.patch
 ext3-remove-cond_resched-calls-2.6.12.patch
-ext3-filterdata-2.6.15.patch
+ext3-filterdata-sles10.patch
+ext3-uninit-2.6.18.patch
 ext3-nanosecond-2.6.18-vanilla.patch
 ext3-inode-version-2.6.18-vanilla.patch
-- 
GitLab