Whamcloud - gitweb
merge b_devel into HEAD, which will become 0.7.3
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-2.5.63.patch
1  fs/ext3/inode.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2  fs/ext3/super.c |    5 ++-
3  fs/ext3/xattr.c |    5 +++
4  fs/ext3/xattr.h |    2 -
5  4 files changed, 92 insertions(+), 4 deletions(-)
6
7 --- linux-2.5.63-nointent/fs/ext3/xattr.c~ext3-2.5.63   Fri Mar 21 18:47:19 2003
8 +++ linux-2.5.63-nointent-root/fs/ext3/xattr.c  Fri Mar 21 18:47:19 2003
9 @@ -1181,3 +1181,8 @@ exit_ext3_xattr(void)
10         ext3_xattr_unregister(EXT3_XATTR_INDEX_USER,
11                               &ext3_xattr_user_handler);
12  }
13 +
14 +EXPORT_SYMBOL(ext3_xattr_get);
15 +EXPORT_SYMBOL(ext3_xattr_set);
16 +EXPORT_SYMBOL(ext3_xattr_set_handle);
17 +
18 --- linux-2.5.63-nointent/fs/ext3/inode.c~ext3-2.5.63   Fri Mar 21 18:47:19 2003
19 +++ linux-2.5.63-nointent-root/fs/ext3/inode.c  Fri Mar 21 18:47:19 2003
20 @@ -1019,7 +1019,7 @@ struct buffer_head *ext3_bread(handle_t 
21         *err = -EIO;
22         return NULL;
23  }
24 -
25 +EXPORT_SYMBOL(ext3_bread);
26  static int walk_page_buffers(  handle_t *handle,
27                                 struct buffer_head *head,
28                                 unsigned from,
29 @@ -2870,3 +2870,85 @@ int ext3_change_inode_journal_flag(struc
30   * here, in ext3_aops_journal_start() to ensure that the forthcoming "see if we
31   * need to extend" test in ext3_prepare_write() succeeds.  
32   */
33 +
34 +/* for each block: 1 ind + 1 dind + 1 tind
35 + * for each block: 3 bitmap blocks
36 + * for each block: 3 group descriptor blocks
37 + * i inode block
38 + * 1 superblock
39 + * 2 * EXT3_SINGLEDATA_TRANS_BLOCKS for the quote files
40 + * ((1+1+1) * 3 * nblocks) + 1 + 1 + 2 * EXT3_SINGLEDATA_TRANS_BLOCKS
41 + *
42 + * XXX assuming:
43 + * (1) fs logic block size == page size
44 + * (2) ext3 in writeback mode
45 + */
46 +static inline int ext3_san_write_trans_blocks(int nblocks)
47 +{
48 +       int ret;
49 +       
50 +       ret = (1 + 1 + 1) * 3 * nblocks + 1 + 1;
51 +
52 +#ifdef CONFIG_QUOTA
53 +       ret += 2 * EXT3_SINGLEDATA_TRANS_BLOCKS;
54 +#endif
55 +
56 +       return ret;
57 +}
58 +
59 +/* Alloc blocks for an inode, while don't create any buffer/page
60 + * for data I/O; set the inode size if file is extended.
61 + *
62 + * @inode:    target inode
63 + * @blocks:   array of logic block number
64 + * @nblocks:  how many blocks need be alloced
65 + * @newsize:  new filesize we should set
66 + *
67 + * return:    0 success, otherwise failed
68 + *            (*blocks) contains physical block number alloced
69 + *
70 + * XXX this assume the fs block size == page size
71 + */
72 +int ext3_prep_san_write(struct inode *inode, long *blocks,
73 +                       int nblocks, loff_t newsize)
74 +{
75 +       handle_t *handle;
76 +       struct buffer_head bh_tmp;
77 +       int needed_blocks;
78 +       int i, ret = 0, ret2;
79 +
80 +       needed_blocks = ext3_san_write_trans_blocks(nblocks);
81 +
82 +       lock_kernel();
83 +       handle = ext3_journal_start(inode, needed_blocks);
84 +       if (IS_ERR(handle)) {
85 +               unlock_kernel();
86 +               return PTR_ERR(handle);
87 +       }
88 +       unlock_kernel();
89 +
90 +       /* alloc blocks one by one */
91 +       for (i = 0; i < nblocks; i++) {
92 +               ret = ext3_get_block_handle(handle, inode, blocks[i],
93 +                                               &bh_tmp, 1, 1);
94 +               if (ret)
95 +                       break;
96 +
97 +               blocks[i] = bh_tmp.b_blocknr;
98 +       }
99 +
100 +       /* set inode size if needed */
101 +       if (!ret && (newsize > inode->i_size)) {
102 +               inode->i_size = newsize;
103 +               ext3_mark_inode_dirty(handle, inode);
104 +       }
105 +
106 +       lock_kernel();
107 +       ret2 = ext3_journal_stop(handle, inode);
108 +       unlock_kernel();
109 +
110 +       if (!ret)
111 +               ret = ret2;
112 +       return ret;
113 +}
114 +EXPORT_SYMBOL(ext3_prep_san_write);
115 --- linux-2.5.63-nointent/fs/ext3/super.c~ext3-2.5.63   Fri Mar 21 18:47:19 2003
116 +++ linux-2.5.63-nointent-root/fs/ext3/super.c  Fri Mar 21 18:47:19 2003
117 @@ -1492,10 +1492,10 @@ static journal_t *ext3_get_dev_journal(s
118                 printk(KERN_ERR "EXT3-fs: I/O error on journal device\n");
119                 goto out_journal;
120         }
121 -       if (ntohl(journal->j_superblock->s_nr_users) != 1) {
122 +       if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
123                 printk(KERN_ERR "EXT3-fs: External journal has more than one "
124                                         "user (unsupported) - %d\n",
125 -                       ntohl(journal->j_superblock->s_nr_users));
126 +                       be32_to_cpu(journal->j_superblock->s_nr_users));
127                 goto out_journal;
128         }
129         EXT3_SB(sb)->journal_bdev = bdev;
130 @@ -1703,6 +1703,7 @@ int ext3_force_commit(struct super_block
131         unlock_kernel();
132         return ret;
133  }
134 +EXPORT_SYMBOL(ext3_force_commit);
135  
136  /*
137   * Ext3 always journals updates to the superblock itself, so we don't
138 --- linux-2.5.63-nointent/fs/ext3/xattr.h~ext3-2.5.63   Fri Mar 21 18:47:19 2003
139 +++ linux-2.5.63-nointent-root/fs/ext3/xattr.h  Fri Mar 21 18:47:19 2003
140 @@ -5,7 +5,7 @@
141  
142    (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
143  */
144 -
145 +#include <linux/module.h>
146  #include <linux/config.h>
147  #include <linux/xattr.h>
148  
149
150 _