diff options
author | Steve French <sfrench@us.ibm.com> | 2007-11-25 04:53:27 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-11-25 04:53:27 -0500 |
commit | 058250a0d5886b4d96a195ecc7e3a75e2df5e4b1 (patch) | |
tree | fb67e8f5258c6aa11d4e8c39650e23de7556b38d /fs | |
parent | cea218054ad277d6c126890213afde07b4eb1602 (diff) | |
parent | 2ffbb8377c7a0713baf6644e285adc27a5654582 (diff) |
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bfs/bfs.h | 4 | ||||
-rw-r--r-- | fs/bfs/dir.c | 146 | ||||
-rw-r--r-- | fs/bfs/file.c | 62 | ||||
-rw-r--r-- | fs/bfs/inode.c | 127 | ||||
-rw-r--r-- | fs/ecryptfs/read_write.c | 2 | ||||
-rw-r--r-- | fs/ext2/ioctl.c | 5 | ||||
-rw-r--r-- | fs/ext3/dir.c | 10 | ||||
-rw-r--r-- | fs/ext3/ioctl.c | 5 | ||||
-rw-r--r-- | fs/ext3/namei.c | 92 | ||||
-rw-r--r-- | fs/ext4/ioctl.c | 5 | ||||
-rw-r--r-- | fs/fuse/file.c | 5 | ||||
-rw-r--r-- | fs/hugetlbfs/inode.c | 11 | ||||
-rw-r--r-- | fs/jfs/ioctl.c | 3 | ||||
-rw-r--r-- | fs/open.c | 2 | ||||
-rw-r--r-- | fs/proc/base.c | 15 | ||||
-rw-r--r-- | fs/proc/generic.c | 39 | ||||
-rw-r--r-- | fs/proc/internal.h | 2 | ||||
-rw-r--r-- | fs/proc/root.c | 2 | ||||
-rw-r--r-- | fs/read_write.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/ioctl.c | 3 | ||||
-rw-r--r-- | fs/reiserfs/stree.c | 3 | ||||
-rw-r--r-- | fs/smbfs/file.c | 7 | ||||
-rw-r--r-- | fs/smbfs/inode.c | 2 | ||||
-rw-r--r-- | fs/smbfs/proc.c | 2 | ||||
-rw-r--r-- | fs/smbfs/smbiod.c | 2 |
25 files changed, 304 insertions, 254 deletions
diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h index 130f6c66c5ba..ac7a8b1d6c3a 100644 --- a/fs/bfs/bfs.h +++ b/fs/bfs/bfs.h | |||
@@ -14,8 +14,6 @@ struct bfs_sb_info { | |||
14 | unsigned long si_blocks; | 14 | unsigned long si_blocks; |
15 | unsigned long si_freeb; | 15 | unsigned long si_freeb; |
16 | unsigned long si_freei; | 16 | unsigned long si_freei; |
17 | unsigned long si_lf_ioff; | ||
18 | unsigned long si_lf_sblk; | ||
19 | unsigned long si_lf_eblk; | 17 | unsigned long si_lf_eblk; |
20 | unsigned long si_lasti; | 18 | unsigned long si_lasti; |
21 | unsigned long * si_imap; | 19 | unsigned long * si_imap; |
@@ -39,7 +37,7 @@ static inline struct bfs_sb_info *BFS_SB(struct super_block *sb) | |||
39 | 37 | ||
40 | static inline struct bfs_inode_info *BFS_I(struct inode *inode) | 38 | static inline struct bfs_inode_info *BFS_I(struct inode *inode) |
41 | { | 39 | { |
42 | return list_entry(inode, struct bfs_inode_info, vfs_inode); | 40 | return container_of(inode, struct bfs_inode_info, vfs_inode); |
43 | } | 41 | } |
44 | 42 | ||
45 | 43 | ||
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 097f1497f743..1fd056d0fc3d 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c | |||
@@ -21,29 +21,32 @@ | |||
21 | #define dprintf(x...) | 21 | #define dprintf(x...) |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | static int bfs_add_entry(struct inode * dir, const unsigned char * name, int namelen, int ino); | 24 | static int bfs_add_entry(struct inode *dir, const unsigned char *name, |
25 | static struct buffer_head * bfs_find_entry(struct inode * dir, | 25 | int namelen, int ino); |
26 | const unsigned char * name, int namelen, struct bfs_dirent ** res_dir); | 26 | static struct buffer_head *bfs_find_entry(struct inode *dir, |
27 | const unsigned char *name, int namelen, | ||
28 | struct bfs_dirent **res_dir); | ||
27 | 29 | ||
28 | static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir) | 30 | static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir) |
29 | { | 31 | { |
30 | struct inode * dir = f->f_path.dentry->d_inode; | 32 | struct inode *dir = f->f_path.dentry->d_inode; |
31 | struct buffer_head * bh; | 33 | struct buffer_head *bh; |
32 | struct bfs_dirent * de; | 34 | struct bfs_dirent *de; |
33 | unsigned int offset; | 35 | unsigned int offset; |
34 | int block; | 36 | int block; |
35 | 37 | ||
36 | lock_kernel(); | 38 | lock_kernel(); |
37 | 39 | ||
38 | if (f->f_pos & (BFS_DIRENT_SIZE-1)) { | 40 | if (f->f_pos & (BFS_DIRENT_SIZE - 1)) { |
39 | printf("Bad f_pos=%08lx for %s:%08lx\n", (unsigned long)f->f_pos, | 41 | printf("Bad f_pos=%08lx for %s:%08lx\n", |
40 | dir->i_sb->s_id, dir->i_ino); | 42 | (unsigned long)f->f_pos, |
43 | dir->i_sb->s_id, dir->i_ino); | ||
41 | unlock_kernel(); | 44 | unlock_kernel(); |
42 | return -EBADF; | 45 | return -EBADF; |
43 | } | 46 | } |
44 | 47 | ||
45 | while (f->f_pos < dir->i_size) { | 48 | while (f->f_pos < dir->i_size) { |
46 | offset = f->f_pos & (BFS_BSIZE-1); | 49 | offset = f->f_pos & (BFS_BSIZE - 1); |
47 | block = BFS_I(dir)->i_sblock + (f->f_pos >> BFS_BSIZE_BITS); | 50 | block = BFS_I(dir)->i_sblock + (f->f_pos >> BFS_BSIZE_BITS); |
48 | bh = sb_bread(dir->i_sb, block); | 51 | bh = sb_bread(dir->i_sb, block); |
49 | if (!bh) { | 52 | if (!bh) { |
@@ -54,7 +57,9 @@ static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir) | |||
54 | de = (struct bfs_dirent *)(bh->b_data + offset); | 57 | de = (struct bfs_dirent *)(bh->b_data + offset); |
55 | if (de->ino) { | 58 | if (de->ino) { |
56 | int size = strnlen(de->name, BFS_NAMELEN); | 59 | int size = strnlen(de->name, BFS_NAMELEN); |
57 | if (filldir(dirent, de->name, size, f->f_pos, le16_to_cpu(de->ino), DT_UNKNOWN) < 0) { | 60 | if (filldir(dirent, de->name, size, f->f_pos, |
61 | le16_to_cpu(de->ino), | ||
62 | DT_UNKNOWN) < 0) { | ||
58 | brelse(bh); | 63 | brelse(bh); |
59 | unlock_kernel(); | 64 | unlock_kernel(); |
60 | return 0; | 65 | return 0; |
@@ -62,7 +67,7 @@ static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir) | |||
62 | } | 67 | } |
63 | offset += BFS_DIRENT_SIZE; | 68 | offset += BFS_DIRENT_SIZE; |
64 | f->f_pos += BFS_DIRENT_SIZE; | 69 | f->f_pos += BFS_DIRENT_SIZE; |
65 | } while (offset < BFS_BSIZE && f->f_pos < dir->i_size); | 70 | } while ((offset < BFS_BSIZE) && (f->f_pos < dir->i_size)); |
66 | brelse(bh); | 71 | brelse(bh); |
67 | } | 72 | } |
68 | 73 | ||
@@ -78,13 +83,13 @@ const struct file_operations bfs_dir_operations = { | |||
78 | 83 | ||
79 | extern void dump_imap(const char *, struct super_block *); | 84 | extern void dump_imap(const char *, struct super_block *); |
80 | 85 | ||
81 | static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, | 86 | static int bfs_create(struct inode *dir, struct dentry *dentry, int mode, |
82 | struct nameidata *nd) | 87 | struct nameidata *nd) |
83 | { | 88 | { |
84 | int err; | 89 | int err; |
85 | struct inode * inode; | 90 | struct inode *inode; |
86 | struct super_block * s = dir->i_sb; | 91 | struct super_block *s = dir->i_sb; |
87 | struct bfs_sb_info * info = BFS_SB(s); | 92 | struct bfs_sb_info *info = BFS_SB(s); |
88 | unsigned long ino; | 93 | unsigned long ino; |
89 | 94 | ||
90 | inode = new_inode(s); | 95 | inode = new_inode(s); |
@@ -97,7 +102,7 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, | |||
97 | iput(inode); | 102 | iput(inode); |
98 | return -ENOSPC; | 103 | return -ENOSPC; |
99 | } | 104 | } |
100 | set_bit(ino, info->si_imap); | 105 | set_bit(ino, info->si_imap); |
101 | info->si_freei--; | 106 | info->si_freei--; |
102 | inode->i_uid = current->fsuid; | 107 | inode->i_uid = current->fsuid; |
103 | inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid; | 108 | inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid; |
@@ -113,9 +118,10 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, | |||
113 | BFS_I(inode)->i_eblock = 0; | 118 | BFS_I(inode)->i_eblock = 0; |
114 | insert_inode_hash(inode); | 119 | insert_inode_hash(inode); |
115 | mark_inode_dirty(inode); | 120 | mark_inode_dirty(inode); |
116 | dump_imap("create",s); | 121 | dump_imap("create", s); |
117 | 122 | ||
118 | err = bfs_add_entry(dir, dentry->d_name.name, dentry->d_name.len, inode->i_ino); | 123 | err = bfs_add_entry(dir, dentry->d_name.name, dentry->d_name.len, |
124 | inode->i_ino); | ||
119 | if (err) { | 125 | if (err) { |
120 | inode_dec_link_count(inode); | 126 | inode_dec_link_count(inode); |
121 | iput(inode); | 127 | iput(inode); |
@@ -127,11 +133,12 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, | |||
127 | return 0; | 133 | return 0; |
128 | } | 134 | } |
129 | 135 | ||
130 | static struct dentry * bfs_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd) | 136 | static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry, |
137 | struct nameidata *nd) | ||
131 | { | 138 | { |
132 | struct inode * inode = NULL; | 139 | struct inode *inode = NULL; |
133 | struct buffer_head * bh; | 140 | struct buffer_head *bh; |
134 | struct bfs_dirent * de; | 141 | struct bfs_dirent *de; |
135 | 142 | ||
136 | if (dentry->d_name.len > BFS_NAMELEN) | 143 | if (dentry->d_name.len > BFS_NAMELEN) |
137 | return ERR_PTR(-ENAMETOOLONG); | 144 | return ERR_PTR(-ENAMETOOLONG); |
@@ -152,13 +159,15 @@ static struct dentry * bfs_lookup(struct inode * dir, struct dentry * dentry, st | |||
152 | return NULL; | 159 | return NULL; |
153 | } | 160 | } |
154 | 161 | ||
155 | static int bfs_link(struct dentry * old, struct inode * dir, struct dentry * new) | 162 | static int bfs_link(struct dentry *old, struct inode *dir, |
163 | struct dentry *new) | ||
156 | { | 164 | { |
157 | struct inode * inode = old->d_inode; | 165 | struct inode *inode = old->d_inode; |
158 | int err; | 166 | int err; |
159 | 167 | ||
160 | lock_kernel(); | 168 | lock_kernel(); |
161 | err = bfs_add_entry(dir, new->d_name.name, new->d_name.len, inode->i_ino); | 169 | err = bfs_add_entry(dir, new->d_name.name, new->d_name.len, |
170 | inode->i_ino); | ||
162 | if (err) { | 171 | if (err) { |
163 | unlock_kernel(); | 172 | unlock_kernel(); |
164 | return err; | 173 | return err; |
@@ -172,23 +181,23 @@ static int bfs_link(struct dentry * old, struct inode * dir, struct dentry * new | |||
172 | return 0; | 181 | return 0; |
173 | } | 182 | } |
174 | 183 | ||
175 | 184 | static int bfs_unlink(struct inode *dir, struct dentry *dentry) | |
176 | static int bfs_unlink(struct inode * dir, struct dentry * dentry) | ||
177 | { | 185 | { |
178 | int error = -ENOENT; | 186 | int error = -ENOENT; |
179 | struct inode * inode; | 187 | struct inode *inode; |
180 | struct buffer_head * bh; | 188 | struct buffer_head *bh; |
181 | struct bfs_dirent * de; | 189 | struct bfs_dirent *de; |
182 | 190 | ||
183 | inode = dentry->d_inode; | 191 | inode = dentry->d_inode; |
184 | lock_kernel(); | 192 | lock_kernel(); |
185 | bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); | 193 | bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); |
186 | if (!bh || le16_to_cpu(de->ino) != inode->i_ino) | 194 | if (!bh || (le16_to_cpu(de->ino) != inode->i_ino)) |
187 | goto out_brelse; | 195 | goto out_brelse; |
188 | 196 | ||
189 | if (!inode->i_nlink) { | 197 | if (!inode->i_nlink) { |
190 | printf("unlinking non-existent file %s:%lu (nlink=%d)\n", inode->i_sb->s_id, | 198 | printf("unlinking non-existent file %s:%lu (nlink=%d)\n", |
191 | inode->i_ino, inode->i_nlink); | 199 | inode->i_sb->s_id, inode->i_ino, |
200 | inode->i_nlink); | ||
192 | inode->i_nlink = 1; | 201 | inode->i_nlink = 1; |
193 | } | 202 | } |
194 | de->ino = 0; | 203 | de->ino = 0; |
@@ -205,12 +214,12 @@ out_brelse: | |||
205 | return error; | 214 | return error; |
206 | } | 215 | } |
207 | 216 | ||
208 | static int bfs_rename(struct inode * old_dir, struct dentry * old_dentry, | 217 | static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
209 | struct inode * new_dir, struct dentry * new_dentry) | 218 | struct inode *new_dir, struct dentry *new_dentry) |
210 | { | 219 | { |
211 | struct inode * old_inode, * new_inode; | 220 | struct inode *old_inode, *new_inode; |
212 | struct buffer_head * old_bh, * new_bh; | 221 | struct buffer_head *old_bh, *new_bh; |
213 | struct bfs_dirent * old_de, * new_de; | 222 | struct bfs_dirent *old_de, *new_de; |
214 | int error = -ENOENT; | 223 | int error = -ENOENT; |
215 | 224 | ||
216 | old_bh = new_bh = NULL; | 225 | old_bh = new_bh = NULL; |
@@ -223,7 +232,7 @@ static int bfs_rename(struct inode * old_dir, struct dentry * old_dentry, | |||
223 | old_dentry->d_name.name, | 232 | old_dentry->d_name.name, |
224 | old_dentry->d_name.len, &old_de); | 233 | old_dentry->d_name.len, &old_de); |
225 | 234 | ||
226 | if (!old_bh || le16_to_cpu(old_de->ino) != old_inode->i_ino) | 235 | if (!old_bh || (le16_to_cpu(old_de->ino) != old_inode->i_ino)) |
227 | goto end_rename; | 236 | goto end_rename; |
228 | 237 | ||
229 | error = -EPERM; | 238 | error = -EPERM; |
@@ -239,7 +248,8 @@ static int bfs_rename(struct inode * old_dir, struct dentry * old_dentry, | |||
239 | if (!new_bh) { | 248 | if (!new_bh) { |
240 | error = bfs_add_entry(new_dir, | 249 | error = bfs_add_entry(new_dir, |
241 | new_dentry->d_name.name, | 250 | new_dentry->d_name.name, |
242 | new_dentry->d_name.len, old_inode->i_ino); | 251 | new_dentry->d_name.len, |
252 | old_inode->i_ino); | ||
243 | if (error) | 253 | if (error) |
244 | goto end_rename; | 254 | goto end_rename; |
245 | } | 255 | } |
@@ -268,11 +278,12 @@ const struct inode_operations bfs_dir_inops = { | |||
268 | .rename = bfs_rename, | 278 | .rename = bfs_rename, |
269 | }; | 279 | }; |
270 | 280 | ||
271 | static int bfs_add_entry(struct inode * dir, const unsigned char * name, int namelen, int ino) | 281 | static int bfs_add_entry(struct inode *dir, const unsigned char *name, |
282 | int namelen, int ino) | ||
272 | { | 283 | { |
273 | struct buffer_head * bh; | 284 | struct buffer_head *bh; |
274 | struct bfs_dirent * de; | 285 | struct bfs_dirent *de; |
275 | int block, sblock, eblock, off, eoff; | 286 | int block, sblock, eblock, off, pos; |
276 | int i; | 287 | int i; |
277 | 288 | ||
278 | dprintf("name=%s, namelen=%d\n", name, namelen); | 289 | dprintf("name=%s, namelen=%d\n", name, namelen); |
@@ -284,27 +295,24 @@ static int bfs_add_entry(struct inode * dir, const unsigned char * name, int nam | |||
284 | 295 | ||
285 | sblock = BFS_I(dir)->i_sblock; | 296 | sblock = BFS_I(dir)->i_sblock; |
286 | eblock = BFS_I(dir)->i_eblock; | 297 | eblock = BFS_I(dir)->i_eblock; |
287 | eoff = dir->i_size % BFS_BSIZE; | 298 | for (block = sblock; block <= eblock; block++) { |
288 | for (block=sblock; block<=eblock; block++) { | ||
289 | bh = sb_bread(dir->i_sb, block); | 299 | bh = sb_bread(dir->i_sb, block); |
290 | if(!bh) | 300 | if (!bh) |
291 | return -ENOSPC; | 301 | return -ENOSPC; |
292 | for (off=0; off<BFS_BSIZE; off+=BFS_DIRENT_SIZE) { | 302 | for (off = 0; off < BFS_BSIZE; off += BFS_DIRENT_SIZE) { |
293 | de = (struct bfs_dirent *)(bh->b_data + off); | 303 | de = (struct bfs_dirent *)(bh->b_data + off); |
294 | if (block==eblock && off>=eoff) { | ||
295 | /* Do not read/interpret the garbage in the end of eblock. */ | ||
296 | de->ino = 0; | ||
297 | } | ||
298 | if (!de->ino) { | 304 | if (!de->ino) { |
299 | if ((block-sblock)*BFS_BSIZE + off >= dir->i_size) { | 305 | pos = (block - sblock) * BFS_BSIZE + off; |
306 | if (pos >= dir->i_size) { | ||
300 | dir->i_size += BFS_DIRENT_SIZE; | 307 | dir->i_size += BFS_DIRENT_SIZE; |
301 | dir->i_ctime = CURRENT_TIME_SEC; | 308 | dir->i_ctime = CURRENT_TIME_SEC; |
302 | } | 309 | } |
303 | dir->i_mtime = CURRENT_TIME_SEC; | 310 | dir->i_mtime = CURRENT_TIME_SEC; |
304 | mark_inode_dirty(dir); | 311 | mark_inode_dirty(dir); |
305 | de->ino = cpu_to_le16((u16)ino); | 312 | de->ino = cpu_to_le16((u16)ino); |
306 | for (i=0; i<BFS_NAMELEN; i++) | 313 | for (i = 0; i < BFS_NAMELEN; i++) |
307 | de->name[i] = (i < namelen) ? name[i] : 0; | 314 | de->name[i] = |
315 | (i < namelen) ? name[i] : 0; | ||
308 | mark_buffer_dirty(bh); | 316 | mark_buffer_dirty(bh); |
309 | brelse(bh); | 317 | brelse(bh); |
310 | return 0; | 318 | return 0; |
@@ -315,25 +323,26 @@ static int bfs_add_entry(struct inode * dir, const unsigned char * name, int nam | |||
315 | return -ENOSPC; | 323 | return -ENOSPC; |
316 | } | 324 | } |
317 | 325 | ||
318 | static inline int bfs_namecmp(int len, const unsigned char * name, const char * buffer) | 326 | static inline int bfs_namecmp(int len, const unsigned char *name, |
327 | const char *buffer) | ||
319 | { | 328 | { |
320 | if (len < BFS_NAMELEN && buffer[len]) | 329 | if ((len < BFS_NAMELEN) && buffer[len]) |
321 | return 0; | 330 | return 0; |
322 | return !memcmp(name, buffer, len); | 331 | return !memcmp(name, buffer, len); |
323 | } | 332 | } |
324 | 333 | ||
325 | static struct buffer_head * bfs_find_entry(struct inode * dir, | 334 | static struct buffer_head *bfs_find_entry(struct inode *dir, |
326 | const unsigned char * name, int namelen, struct bfs_dirent ** res_dir) | 335 | const unsigned char *name, int namelen, |
336 | struct bfs_dirent **res_dir) | ||
327 | { | 337 | { |
328 | unsigned long block, offset; | 338 | unsigned long block = 0, offset = 0; |
329 | struct buffer_head * bh; | 339 | struct buffer_head *bh = NULL; |
330 | struct bfs_dirent * de; | 340 | struct bfs_dirent *de; |
331 | 341 | ||
332 | *res_dir = NULL; | 342 | *res_dir = NULL; |
333 | if (namelen > BFS_NAMELEN) | 343 | if (namelen > BFS_NAMELEN) |
334 | return NULL; | 344 | return NULL; |
335 | bh = NULL; | 345 | |
336 | block = offset = 0; | ||
337 | while (block * BFS_BSIZE + offset < dir->i_size) { | 346 | while (block * BFS_BSIZE + offset < dir->i_size) { |
338 | if (!bh) { | 347 | if (!bh) { |
339 | bh = sb_bread(dir->i_sb, BFS_I(dir)->i_sblock + block); | 348 | bh = sb_bread(dir->i_sb, BFS_I(dir)->i_sblock + block); |
@@ -344,7 +353,8 @@ static struct buffer_head * bfs_find_entry(struct inode * dir, | |||
344 | } | 353 | } |
345 | de = (struct bfs_dirent *)(bh->b_data + offset); | 354 | de = (struct bfs_dirent *)(bh->b_data + offset); |
346 | offset += BFS_DIRENT_SIZE; | 355 | offset += BFS_DIRENT_SIZE; |
347 | if (le16_to_cpu(de->ino) && bfs_namecmp(namelen, name, de->name)) { | 356 | if (le16_to_cpu(de->ino) && |
357 | bfs_namecmp(namelen, name, de->name)) { | ||
348 | *res_dir = de; | 358 | *res_dir = de; |
349 | return bh; | 359 | return bh; |
350 | } | 360 | } |
diff --git a/fs/bfs/file.c b/fs/bfs/file.c index 911b4ccf470f..b11e63e8fbcd 100644 --- a/fs/bfs/file.c +++ b/fs/bfs/file.c | |||
@@ -2,6 +2,11 @@ | |||
2 | * fs/bfs/file.c | 2 | * fs/bfs/file.c |
3 | * BFS file operations. | 3 | * BFS file operations. |
4 | * Copyright (C) 1999,2000 Tigran Aivazian <tigran@veritas.com> | 4 | * Copyright (C) 1999,2000 Tigran Aivazian <tigran@veritas.com> |
5 | * | ||
6 | * Make the file block allocation algorithm understand the size | ||
7 | * of the underlying block device. | ||
8 | * Copyright (C) 2007 Dmitri Vorobiev <dmitri.vorobiev@gmail.com> | ||
9 | * | ||
5 | */ | 10 | */ |
6 | 11 | ||
7 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
@@ -27,7 +32,8 @@ const struct file_operations bfs_file_operations = { | |||
27 | .splice_read = generic_file_splice_read, | 32 | .splice_read = generic_file_splice_read, |
28 | }; | 33 | }; |
29 | 34 | ||
30 | static int bfs_move_block(unsigned long from, unsigned long to, struct super_block *sb) | 35 | static int bfs_move_block(unsigned long from, unsigned long to, |
36 | struct super_block *sb) | ||
31 | { | 37 | { |
32 | struct buffer_head *bh, *new; | 38 | struct buffer_head *bh, *new; |
33 | 39 | ||
@@ -43,21 +49,22 @@ static int bfs_move_block(unsigned long from, unsigned long to, struct super_blo | |||
43 | } | 49 | } |
44 | 50 | ||
45 | static int bfs_move_blocks(struct super_block *sb, unsigned long start, | 51 | static int bfs_move_blocks(struct super_block *sb, unsigned long start, |
46 | unsigned long end, unsigned long where) | 52 | unsigned long end, unsigned long where) |
47 | { | 53 | { |
48 | unsigned long i; | 54 | unsigned long i; |
49 | 55 | ||
50 | dprintf("%08lx-%08lx->%08lx\n", start, end, where); | 56 | dprintf("%08lx-%08lx->%08lx\n", start, end, where); |
51 | for (i = start; i <= end; i++) | 57 | for (i = start; i <= end; i++) |
52 | if(bfs_move_block(i, where + i, sb)) { | 58 | if(bfs_move_block(i, where + i, sb)) { |
53 | dprintf("failed to move block %08lx -> %08lx\n", i, where + i); | 59 | dprintf("failed to move block %08lx -> %08lx\n", i, |
60 | where + i); | ||
54 | return -EIO; | 61 | return -EIO; |
55 | } | 62 | } |
56 | return 0; | 63 | return 0; |
57 | } | 64 | } |
58 | 65 | ||
59 | static int bfs_get_block(struct inode * inode, sector_t block, | 66 | static int bfs_get_block(struct inode *inode, sector_t block, |
60 | struct buffer_head * bh_result, int create) | 67 | struct buffer_head *bh_result, int create) |
61 | { | 68 | { |
62 | unsigned long phys; | 69 | unsigned long phys; |
63 | int err; | 70 | int err; |
@@ -66,9 +73,6 @@ static int bfs_get_block(struct inode * inode, sector_t block, | |||
66 | struct bfs_inode_info *bi = BFS_I(inode); | 73 | struct bfs_inode_info *bi = BFS_I(inode); |
67 | struct buffer_head *sbh = info->si_sbh; | 74 | struct buffer_head *sbh = info->si_sbh; |
68 | 75 | ||
69 | if (block > info->si_blocks) | ||
70 | return -EIO; | ||
71 | |||
72 | phys = bi->i_sblock + block; | 76 | phys = bi->i_sblock + block; |
73 | if (!create) { | 77 | if (!create) { |
74 | if (phys <= bi->i_eblock) { | 78 | if (phys <= bi->i_eblock) { |
@@ -79,21 +83,29 @@ static int bfs_get_block(struct inode * inode, sector_t block, | |||
79 | return 0; | 83 | return 0; |
80 | } | 84 | } |
81 | 85 | ||
82 | /* if the file is not empty and the requested block is within the range | 86 | /* |
83 | of blocks allocated for this file, we can grant it */ | 87 | * If the file is not empty and the requested block is within the |
84 | if (inode->i_size && phys <= bi->i_eblock) { | 88 | * range of blocks allocated for this file, we can grant it. |
89 | */ | ||
90 | if (bi->i_sblock && (phys <= bi->i_eblock)) { | ||
85 | dprintf("c=%d, b=%08lx, phys=%08lx (interim block granted)\n", | 91 | dprintf("c=%d, b=%08lx, phys=%08lx (interim block granted)\n", |
86 | create, (unsigned long)block, phys); | 92 | create, (unsigned long)block, phys); |
87 | map_bh(bh_result, sb, phys); | 93 | map_bh(bh_result, sb, phys); |
88 | return 0; | 94 | return 0; |
89 | } | 95 | } |
90 | 96 | ||
91 | /* the rest has to be protected against itself */ | 97 | /* The file will be extended, so let's see if there is enough space. */ |
98 | if (phys >= info->si_blocks) | ||
99 | return -ENOSPC; | ||
100 | |||
101 | /* The rest has to be protected against itself. */ | ||
92 | lock_kernel(); | 102 | lock_kernel(); |
93 | 103 | ||
94 | /* if the last data block for this file is the last allocated | 104 | /* |
95 | block, we can extend the file trivially, without moving it | 105 | * If the last data block for this file is the last allocated |
96 | anywhere */ | 106 | * block, we can extend the file trivially, without moving it |
107 | * anywhere. | ||
108 | */ | ||
97 | if (bi->i_eblock == info->si_lf_eblk) { | 109 | if (bi->i_eblock == info->si_lf_eblk) { |
98 | dprintf("c=%d, b=%08lx, phys=%08lx (simple extension)\n", | 110 | dprintf("c=%d, b=%08lx, phys=%08lx (simple extension)\n", |
99 | create, (unsigned long)block, phys); | 111 | create, (unsigned long)block, phys); |
@@ -106,13 +118,19 @@ static int bfs_get_block(struct inode * inode, sector_t block, | |||
106 | goto out; | 118 | goto out; |
107 | } | 119 | } |
108 | 120 | ||
109 | /* Ok, we have to move this entire file to the next free block */ | 121 | /* Ok, we have to move this entire file to the next free block. */ |
110 | phys = info->si_lf_eblk + 1; | 122 | phys = info->si_lf_eblk + 1; |
111 | if (bi->i_sblock) { /* if data starts on block 0 then there is no data */ | 123 | if (phys + block >= info->si_blocks) { |
124 | err = -ENOSPC; | ||
125 | goto out; | ||
126 | } | ||
127 | |||
128 | if (bi->i_sblock) { | ||
112 | err = bfs_move_blocks(inode->i_sb, bi->i_sblock, | 129 | err = bfs_move_blocks(inode->i_sb, bi->i_sblock, |
113 | bi->i_eblock, phys); | 130 | bi->i_eblock, phys); |
114 | if (err) { | 131 | if (err) { |
115 | dprintf("failed to move ino=%08lx -> fs corruption\n", inode->i_ino); | 132 | dprintf("failed to move ino=%08lx -> fs corruption\n", |
133 | inode->i_ino); | ||
116 | goto out; | 134 | goto out; |
117 | } | 135 | } |
118 | } else | 136 | } else |
@@ -124,8 +142,10 @@ static int bfs_get_block(struct inode * inode, sector_t block, | |||
124 | phys += block; | 142 | phys += block; |
125 | info->si_lf_eblk = bi->i_eblock = phys; | 143 | info->si_lf_eblk = bi->i_eblock = phys; |
126 | 144 | ||
127 | /* this assumes nothing can write the inode back while we are here | 145 | /* |
128 | * and thus update inode->i_blocks! (XXX)*/ | 146 | * This assumes nothing can write the inode back while we are here |
147 | * and thus update inode->i_blocks! (XXX) | ||
148 | */ | ||
129 | info->si_freeb -= bi->i_eblock - bi->i_sblock + 1 - inode->i_blocks; | 149 | info->si_freeb -= bi->i_eblock - bi->i_sblock + 1 - inode->i_blocks; |
130 | mark_inode_dirty(inode); | 150 | mark_inode_dirty(inode); |
131 | mark_buffer_dirty(sbh); | 151 | mark_buffer_dirty(sbh); |
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 7bd9c2bbe6ee..294c41baef6e 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -30,25 +30,26 @@ MODULE_LICENSE("GPL"); | |||
30 | #define dprintf(x...) | 30 | #define dprintf(x...) |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | void dump_imap(const char *prefix, struct super_block * s); | 33 | void dump_imap(const char *prefix, struct super_block *s); |
34 | 34 | ||
35 | static void bfs_read_inode(struct inode * inode) | 35 | static void bfs_read_inode(struct inode *inode) |
36 | { | 36 | { |
37 | unsigned long ino = inode->i_ino; | 37 | unsigned long ino = inode->i_ino; |
38 | struct bfs_inode * di; | 38 | struct bfs_inode *di; |
39 | struct buffer_head * bh; | 39 | struct buffer_head *bh; |
40 | int block, off; | 40 | int block, off; |
41 | 41 | ||
42 | if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) { | 42 | if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode->i_sb)->si_lasti)) { |
43 | printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino); | 43 | printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino); |
44 | make_bad_inode(inode); | 44 | make_bad_inode(inode); |
45 | return; | 45 | return; |
46 | } | 46 | } |
47 | 47 | ||
48 | block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; | 48 | block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; |
49 | bh = sb_bread(inode->i_sb, block); | 49 | bh = sb_bread(inode->i_sb, block); |
50 | if (!bh) { | 50 | if (!bh) { |
51 | printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino); | 51 | printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, |
52 | ino); | ||
52 | make_bad_inode(inode); | 53 | make_bad_inode(inode); |
53 | return; | 54 | return; |
54 | } | 55 | } |
@@ -56,7 +57,7 @@ static void bfs_read_inode(struct inode * inode) | |||
56 | off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; | 57 | off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; |
57 | di = (struct bfs_inode *)bh->b_data + off; | 58 | di = (struct bfs_inode *)bh->b_data + off; |
58 | 59 | ||
59 | inode->i_mode = 0x0000FFFF & le32_to_cpu(di->i_mode); | 60 | inode->i_mode = 0x0000FFFF & le32_to_cpu(di->i_mode); |
60 | if (le32_to_cpu(di->i_vtype) == BFS_VDIR) { | 61 | if (le32_to_cpu(di->i_vtype) == BFS_VDIR) { |
61 | inode->i_mode |= S_IFDIR; | 62 | inode->i_mode |= S_IFDIR; |
62 | inode->i_op = &bfs_dir_inops; | 63 | inode->i_op = &bfs_dir_inops; |
@@ -70,48 +71,48 @@ static void bfs_read_inode(struct inode * inode) | |||
70 | 71 | ||
71 | BFS_I(inode)->i_sblock = le32_to_cpu(di->i_sblock); | 72 | BFS_I(inode)->i_sblock = le32_to_cpu(di->i_sblock); |
72 | BFS_I(inode)->i_eblock = le32_to_cpu(di->i_eblock); | 73 | BFS_I(inode)->i_eblock = le32_to_cpu(di->i_eblock); |
74 | BFS_I(inode)->i_dsk_ino = le16_to_cpu(di->i_ino); | ||
73 | inode->i_uid = le32_to_cpu(di->i_uid); | 75 | inode->i_uid = le32_to_cpu(di->i_uid); |
74 | inode->i_gid = le32_to_cpu(di->i_gid); | 76 | inode->i_gid = le32_to_cpu(di->i_gid); |
75 | inode->i_nlink = le32_to_cpu(di->i_nlink); | 77 | inode->i_nlink = le32_to_cpu(di->i_nlink); |
76 | inode->i_size = BFS_FILESIZE(di); | 78 | inode->i_size = BFS_FILESIZE(di); |
77 | inode->i_blocks = BFS_FILEBLOCKS(di); | 79 | inode->i_blocks = BFS_FILEBLOCKS(di); |
78 | if (inode->i_size || inode->i_blocks) dprintf("Registered inode with %lld size, %ld blocks\n", inode->i_size, inode->i_blocks); | ||
79 | inode->i_atime.tv_sec = le32_to_cpu(di->i_atime); | 80 | inode->i_atime.tv_sec = le32_to_cpu(di->i_atime); |
80 | inode->i_mtime.tv_sec = le32_to_cpu(di->i_mtime); | 81 | inode->i_mtime.tv_sec = le32_to_cpu(di->i_mtime); |
81 | inode->i_ctime.tv_sec = le32_to_cpu(di->i_ctime); | 82 | inode->i_ctime.tv_sec = le32_to_cpu(di->i_ctime); |
82 | inode->i_atime.tv_nsec = 0; | 83 | inode->i_atime.tv_nsec = 0; |
83 | inode->i_mtime.tv_nsec = 0; | 84 | inode->i_mtime.tv_nsec = 0; |
84 | inode->i_ctime.tv_nsec = 0; | 85 | inode->i_ctime.tv_nsec = 0; |
85 | BFS_I(inode)->i_dsk_ino = le16_to_cpu(di->i_ino); /* can be 0 so we store a copy */ | ||
86 | 86 | ||
87 | brelse(bh); | 87 | brelse(bh); |
88 | } | 88 | } |
89 | 89 | ||
90 | static int bfs_write_inode(struct inode * inode, int unused) | 90 | static int bfs_write_inode(struct inode *inode, int unused) |
91 | { | 91 | { |
92 | unsigned int ino = (u16)inode->i_ino; | 92 | unsigned int ino = (u16)inode->i_ino; |
93 | unsigned long i_sblock; | 93 | unsigned long i_sblock; |
94 | struct bfs_inode * di; | 94 | struct bfs_inode *di; |
95 | struct buffer_head * bh; | 95 | struct buffer_head *bh; |
96 | int block, off; | 96 | int block, off; |
97 | 97 | ||
98 | dprintf("ino=%08x\n", ino); | 98 | dprintf("ino=%08x\n", ino); |
99 | 99 | ||
100 | if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) { | 100 | if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode->i_sb)->si_lasti)) { |
101 | printf("Bad inode number %s:%08x\n", inode->i_sb->s_id, ino); | 101 | printf("Bad inode number %s:%08x\n", inode->i_sb->s_id, ino); |
102 | return -EIO; | 102 | return -EIO; |
103 | } | 103 | } |
104 | 104 | ||
105 | lock_kernel(); | 105 | lock_kernel(); |
106 | block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; | 106 | block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; |
107 | bh = sb_bread(inode->i_sb, block); | 107 | bh = sb_bread(inode->i_sb, block); |
108 | if (!bh) { | 108 | if (!bh) { |
109 | printf("Unable to read inode %s:%08x\n", inode->i_sb->s_id, ino); | 109 | printf("Unable to read inode %s:%08x\n", |
110 | inode->i_sb->s_id, ino); | ||
110 | unlock_kernel(); | 111 | unlock_kernel(); |
111 | return -EIO; | 112 | return -EIO; |
112 | } | 113 | } |
113 | 114 | ||
114 | off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK; | 115 | off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; |
115 | di = (struct bfs_inode *)bh->b_data + off; | 116 | di = (struct bfs_inode *)bh->b_data + off; |
116 | 117 | ||
117 | if (ino == BFS_ROOT_INO) | 118 | if (ino == BFS_ROOT_INO) |
@@ -133,27 +134,26 @@ static int bfs_write_inode(struct inode * inode, int unused) | |||
133 | di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1); | 134 | di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1); |
134 | 135 | ||
135 | mark_buffer_dirty(bh); | 136 | mark_buffer_dirty(bh); |
136 | dprintf("Written ino=%d into %d:%d\n",le16_to_cpu(di->i_ino),block,off); | ||
137 | brelse(bh); | 137 | brelse(bh); |
138 | unlock_kernel(); | 138 | unlock_kernel(); |
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
141 | 141 | ||
142 | static void bfs_delete_inode(struct inode * inode) | 142 | static void bfs_delete_inode(struct inode *inode) |
143 | { | 143 | { |
144 | unsigned long ino = inode->i_ino; | 144 | unsigned long ino = inode->i_ino; |
145 | struct bfs_inode * di; | 145 | struct bfs_inode *di; |
146 | struct buffer_head * bh; | 146 | struct buffer_head *bh; |
147 | int block, off; | 147 | int block, off; |
148 | struct super_block * s = inode->i_sb; | 148 | struct super_block *s = inode->i_sb; |
149 | struct bfs_sb_info * info = BFS_SB(s); | 149 | struct bfs_sb_info *info = BFS_SB(s); |
150 | struct bfs_inode_info * bi = BFS_I(inode); | 150 | struct bfs_inode_info *bi = BFS_I(inode); |
151 | 151 | ||
152 | dprintf("ino=%08lx\n", ino); | 152 | dprintf("ino=%08lx\n", ino); |
153 | 153 | ||
154 | truncate_inode_pages(&inode->i_data, 0); | 154 | truncate_inode_pages(&inode->i_data, 0); |
155 | 155 | ||
156 | if (ino < BFS_ROOT_INO || ino > info->si_lasti) { | 156 | if ((ino < BFS_ROOT_INO) || (ino > info->si_lasti)) { |
157 | printf("invalid ino=%08lx\n", ino); | 157 | printf("invalid ino=%08lx\n", ino); |
158 | return; | 158 | return; |
159 | } | 159 | } |
@@ -162,31 +162,35 @@ static void bfs_delete_inode(struct inode * inode) | |||
162 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; | 162 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; |
163 | lock_kernel(); | 163 | lock_kernel(); |
164 | mark_inode_dirty(inode); | 164 | mark_inode_dirty(inode); |
165 | block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; | 165 | |
166 | block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; | ||
166 | bh = sb_bread(s, block); | 167 | bh = sb_bread(s, block); |
167 | if (!bh) { | 168 | if (!bh) { |
168 | printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino); | 169 | printf("Unable to read inode %s:%08lx\n", |
170 | inode->i_sb->s_id, ino); | ||
169 | unlock_kernel(); | 171 | unlock_kernel(); |
170 | return; | 172 | return; |
171 | } | 173 | } |
172 | off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK; | 174 | off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; |
173 | di = (struct bfs_inode *) bh->b_data + off; | 175 | di = (struct bfs_inode *)bh->b_data + off; |
176 | memset((void *)di, 0, sizeof(struct bfs_inode)); | ||
177 | mark_buffer_dirty(bh); | ||
178 | brelse(bh); | ||
179 | |||
174 | if (bi->i_dsk_ino) { | 180 | if (bi->i_dsk_ino) { |
175 | info->si_freeb += 1 + bi->i_eblock - bi->i_sblock; | 181 | info->si_freeb += BFS_FILEBLOCKS(bi); |
176 | info->si_freei++; | 182 | info->si_freei++; |
177 | clear_bit(ino, info->si_imap); | 183 | clear_bit(ino, info->si_imap); |
178 | dump_imap("delete_inode", s); | 184 | dump_imap("delete_inode", s); |
179 | } | 185 | } |
180 | di->i_ino = 0; | ||
181 | di->i_sblock = 0; | ||
182 | mark_buffer_dirty(bh); | ||
183 | brelse(bh); | ||
184 | 186 | ||
185 | /* if this was the last file, make the previous | 187 | /* |
186 | block "last files last block" even if there is no real file there, | 188 | * If this was the last file, make the previous block |
187 | saves us 1 gap */ | 189 | * "last block of the last file" even if there is no |
188 | if (info->si_lf_eblk == BFS_I(inode)->i_eblock) { | 190 | * real file there, saves us 1 gap. |
189 | info->si_lf_eblk = BFS_I(inode)->i_sblock - 1; | 191 | */ |
192 | if (info->si_lf_eblk == bi->i_eblock) { | ||
193 | info->si_lf_eblk = bi->i_sblock - 1; | ||
190 | mark_buffer_dirty(info->si_sbh); | 194 | mark_buffer_dirty(info->si_sbh); |
191 | } | 195 | } |
192 | unlock_kernel(); | 196 | unlock_kernel(); |
@@ -228,7 +232,7 @@ static void bfs_write_super(struct super_block *s) | |||
228 | unlock_kernel(); | 232 | unlock_kernel(); |
229 | } | 233 | } |
230 | 234 | ||
231 | static struct kmem_cache * bfs_inode_cachep; | 235 | static struct kmem_cache *bfs_inode_cachep; |
232 | 236 | ||
233 | static struct inode *bfs_alloc_inode(struct super_block *sb) | 237 | static struct inode *bfs_alloc_inode(struct super_block *sb) |
234 | { | 238 | { |
@@ -279,7 +283,7 @@ static const struct super_operations bfs_sops = { | |||
279 | .statfs = bfs_statfs, | 283 | .statfs = bfs_statfs, |
280 | }; | 284 | }; |
281 | 285 | ||
282 | void dump_imap(const char *prefix, struct super_block * s) | 286 | void dump_imap(const char *prefix, struct super_block *s) |
283 | { | 287 | { |
284 | #ifdef DEBUG | 288 | #ifdef DEBUG |
285 | int i; | 289 | int i; |
@@ -287,25 +291,26 @@ void dump_imap(const char *prefix, struct super_block * s) | |||
287 | 291 | ||
288 | if (!tmpbuf) | 292 | if (!tmpbuf) |
289 | return; | 293 | return; |
290 | for (i=BFS_SB(s)->si_lasti; i>=0; i--) { | 294 | for (i = BFS_SB(s)->si_lasti; i >= 0; i--) { |
291 | if (i > PAGE_SIZE-100) break; | 295 | if (i > PAGE_SIZE - 100) break; |
292 | if (test_bit(i, BFS_SB(s)->si_imap)) | 296 | if (test_bit(i, BFS_SB(s)->si_imap)) |
293 | strcat(tmpbuf, "1"); | 297 | strcat(tmpbuf, "1"); |
294 | else | 298 | else |
295 | strcat(tmpbuf, "0"); | 299 | strcat(tmpbuf, "0"); |
296 | } | 300 | } |
297 | printk(KERN_ERR "BFS-fs: %s: lasti=%08lx <%s>\n", prefix, BFS_SB(s)->si_lasti, tmpbuf); | 301 | printf("BFS-fs: %s: lasti=%08lx <%s>\n", |
302 | prefix, BFS_SB(s)->si_lasti, tmpbuf); | ||
298 | free_page((unsigned long)tmpbuf); | 303 | free_page((unsigned long)tmpbuf); |
299 | #endif | 304 | #endif |
300 | } | 305 | } |
301 | 306 | ||
302 | static int bfs_fill_super(struct super_block *s, void *data, int silent) | 307 | static int bfs_fill_super(struct super_block *s, void *data, int silent) |
303 | { | 308 | { |
304 | struct buffer_head * bh; | 309 | struct buffer_head *bh; |
305 | struct bfs_super_block * bfs_sb; | 310 | struct bfs_super_block *bfs_sb; |
306 | struct inode * inode; | 311 | struct inode *inode; |
307 | unsigned i, imap_len; | 312 | unsigned i, imap_len; |
308 | struct bfs_sb_info * info; | 313 | struct bfs_sb_info *info; |
309 | 314 | ||
310 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 315 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
311 | if (!info) | 316 | if (!info) |
@@ -329,14 +334,14 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
329 | 334 | ||
330 | s->s_magic = BFS_MAGIC; | 335 | s->s_magic = BFS_MAGIC; |
331 | info->si_sbh = bh; | 336 | info->si_sbh = bh; |
332 | info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE)/sizeof(struct bfs_inode) | 337 | info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) / |
333 | + BFS_ROOT_INO - 1; | 338 | sizeof(struct bfs_inode) |
334 | 339 | + BFS_ROOT_INO - 1; | |
335 | imap_len = info->si_lasti/8 + 1; | 340 | imap_len = (info->si_lasti / 8) + 1; |
336 | info->si_imap = kzalloc(imap_len, GFP_KERNEL); | 341 | info->si_imap = kzalloc(imap_len, GFP_KERNEL); |
337 | if (!info->si_imap) | 342 | if (!info->si_imap) |
338 | goto out; | 343 | goto out; |
339 | for (i=0; i<BFS_ROOT_INO; i++) | 344 | for (i = 0; i < BFS_ROOT_INO; i++) |
340 | set_bit(i, info->si_imap); | 345 | set_bit(i, info->si_imap); |
341 | 346 | ||
342 | s->s_op = &bfs_sops; | 347 | s->s_op = &bfs_sops; |
@@ -352,16 +357,15 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
352 | goto out; | 357 | goto out; |
353 | } | 358 | } |
354 | 359 | ||
355 | info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1)>>BFS_BSIZE_BITS; /* for statfs(2) */ | 360 | info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1) >> BFS_BSIZE_BITS; |
356 | info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 - le32_to_cpu(bfs_sb->s_start))>>BFS_BSIZE_BITS; | 361 | info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 |
362 | - le32_to_cpu(bfs_sb->s_start)) >> BFS_BSIZE_BITS; | ||
357 | info->si_freei = 0; | 363 | info->si_freei = 0; |
358 | info->si_lf_eblk = 0; | 364 | info->si_lf_eblk = 0; |
359 | info->si_lf_sblk = 0; | ||
360 | info->si_lf_ioff = 0; | ||
361 | bh = NULL; | 365 | bh = NULL; |
362 | for (i=BFS_ROOT_INO; i<=info->si_lasti; i++) { | 366 | for (i = BFS_ROOT_INO; i <= info->si_lasti; i++) { |
363 | struct bfs_inode *di; | 367 | struct bfs_inode *di; |
364 | int block = (i - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; | 368 | int block = (i - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; |
365 | int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; | 369 | int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; |
366 | unsigned long sblock, eblock; | 370 | unsigned long sblock, eblock; |
367 | 371 | ||
@@ -384,11 +388,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
384 | 388 | ||
385 | sblock = le32_to_cpu(di->i_sblock); | 389 | sblock = le32_to_cpu(di->i_sblock); |
386 | eblock = le32_to_cpu(di->i_eblock); | 390 | eblock = le32_to_cpu(di->i_eblock); |
387 | if (eblock > info->si_lf_eblk) { | 391 | if (eblock > info->si_lf_eblk) |
388 | info->si_lf_eblk = eblock; | 392 | info->si_lf_eblk = eblock; |
389 | info->si_lf_sblk = sblock; | ||
390 | info->si_lf_ioff = BFS_INO2OFF(i); | ||
391 | } | ||
392 | } | 393 | } |
393 | brelse(bh); | 394 | brelse(bh); |
394 | if (!(s->s_flags & MS_RDONLY)) { | 395 | if (!(s->s_flags & MS_RDONLY)) { |
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c index 2150edf9a58e..6b7474a4336a 100644 --- a/fs/ecryptfs/read_write.c +++ b/fs/ecryptfs/read_write.c | |||
@@ -87,7 +87,7 @@ int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode, | |||
87 | loff_t offset; | 87 | loff_t offset; |
88 | int rc; | 88 | int rc; |
89 | 89 | ||
90 | offset = ((((off_t)page_for_lower->index) << PAGE_CACHE_SHIFT) | 90 | offset = ((((loff_t)page_for_lower->index) << PAGE_CACHE_SHIFT) |
91 | + offset_in_page); | 91 | + offset_in_page); |
92 | virt = kmap(page_for_lower); | 92 | virt = kmap(page_for_lower); |
93 | rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size); | 93 | rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size); |
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index c2324d5fe4ac..320b2cb3d4d2 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c | |||
@@ -47,6 +47,11 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
47 | flags &= ~EXT2_DIRSYNC_FL; | 47 | flags &= ~EXT2_DIRSYNC_FL; |
48 | 48 | ||
49 | mutex_lock(&inode->i_mutex); | 49 | mutex_lock(&inode->i_mutex); |
50 | /* Is it quota file? Do not allow user to mess with it */ | ||
51 | if (IS_NOQUOTA(inode)) { | ||
52 | mutex_unlock(&inode->i_mutex); | ||
53 | return -EPERM; | ||
54 | } | ||
50 | oldflags = ei->i_flags; | 55 | oldflags = ei->i_flags; |
51 | 56 | ||
52 | /* | 57 | /* |
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index c8e4ee3af1d0..8ca3bfd72427 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -67,7 +67,7 @@ int ext3_check_dir_entry (const char * function, struct inode * dir, | |||
67 | unsigned long offset) | 67 | unsigned long offset) |
68 | { | 68 | { |
69 | const char * error_msg = NULL; | 69 | const char * error_msg = NULL; |
70 | const int rlen = le16_to_cpu(de->rec_len); | 70 | const int rlen = ext3_rec_len_from_disk(de->rec_len); |
71 | 71 | ||
72 | if (rlen < EXT3_DIR_REC_LEN(1)) | 72 | if (rlen < EXT3_DIR_REC_LEN(1)) |
73 | error_msg = "rec_len is smaller than minimal"; | 73 | error_msg = "rec_len is smaller than minimal"; |
@@ -173,10 +173,10 @@ revalidate: | |||
173 | * least that it is non-zero. A | 173 | * least that it is non-zero. A |
174 | * failure will be detected in the | 174 | * failure will be detected in the |
175 | * dirent test below. */ | 175 | * dirent test below. */ |
176 | if (le16_to_cpu(de->rec_len) < | 176 | if (ext3_rec_len_from_disk(de->rec_len) < |
177 | EXT3_DIR_REC_LEN(1)) | 177 | EXT3_DIR_REC_LEN(1)) |
178 | break; | 178 | break; |
179 | i += le16_to_cpu(de->rec_len); | 179 | i += ext3_rec_len_from_disk(de->rec_len); |
180 | } | 180 | } |
181 | offset = i; | 181 | offset = i; |
182 | filp->f_pos = (filp->f_pos & ~(sb->s_blocksize - 1)) | 182 | filp->f_pos = (filp->f_pos & ~(sb->s_blocksize - 1)) |
@@ -197,7 +197,7 @@ revalidate: | |||
197 | ret = stored; | 197 | ret = stored; |
198 | goto out; | 198 | goto out; |
199 | } | 199 | } |
200 | offset += le16_to_cpu(de->rec_len); | 200 | offset += ext3_rec_len_from_disk(de->rec_len); |
201 | if (le32_to_cpu(de->inode)) { | 201 | if (le32_to_cpu(de->inode)) { |
202 | /* We might block in the next section | 202 | /* We might block in the next section |
203 | * if the data destination is | 203 | * if the data destination is |
@@ -219,7 +219,7 @@ revalidate: | |||
219 | goto revalidate; | 219 | goto revalidate; |
220 | stored ++; | 220 | stored ++; |
221 | } | 221 | } |
222 | filp->f_pos += le16_to_cpu(de->rec_len); | 222 | filp->f_pos += ext3_rec_len_from_disk(de->rec_len); |
223 | } | 223 | } |
224 | offset = 0; | 224 | offset = 0; |
225 | brelse (bh); | 225 | brelse (bh); |
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 4a2a02c95bf9..023a070f55f1 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -51,6 +51,11 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
51 | flags &= ~EXT3_DIRSYNC_FL; | 51 | flags &= ~EXT3_DIRSYNC_FL; |
52 | 52 | ||
53 | mutex_lock(&inode->i_mutex); | 53 | mutex_lock(&inode->i_mutex); |
54 | /* Is it quota file? Do not allow user to mess with it */ | ||
55 | if (IS_NOQUOTA(inode)) { | ||
56 | mutex_unlock(&inode->i_mutex); | ||
57 | return -EPERM; | ||
58 | } | ||
54 | oldflags = ei->i_flags; | 59 | oldflags = ei->i_flags; |
55 | 60 | ||
56 | /* The JOURNAL_DATA flag is modifiable only by root */ | 61 | /* The JOURNAL_DATA flag is modifiable only by root */ |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index ec8170adac53..4ab6f76e63d0 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -177,6 +177,16 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, | |||
177 | struct inode *inode); | 177 | struct inode *inode); |
178 | 178 | ||
179 | /* | 179 | /* |
180 | * p is at least 6 bytes before the end of page | ||
181 | */ | ||
182 | static inline struct ext3_dir_entry_2 * | ||
183 | ext3_next_entry(struct ext3_dir_entry_2 *p) | ||
184 | { | ||
185 | return (struct ext3_dir_entry_2 *)((char *)p + | ||
186 | ext3_rec_len_from_disk(p->rec_len)); | ||
187 | } | ||
188 | |||
189 | /* | ||
180 | * Future: use high four bits of block for coalesce-on-delete flags | 190 | * Future: use high four bits of block for coalesce-on-delete flags |
181 | * Mask them off for now. | 191 | * Mask them off for now. |
182 | */ | 192 | */ |
@@ -280,7 +290,7 @@ static struct stats dx_show_leaf(struct dx_hash_info *hinfo, struct ext3_dir_ent | |||
280 | space += EXT3_DIR_REC_LEN(de->name_len); | 290 | space += EXT3_DIR_REC_LEN(de->name_len); |
281 | names++; | 291 | names++; |
282 | } | 292 | } |
283 | de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len)); | 293 | de = ext3_next_entry(de); |
284 | } | 294 | } |
285 | printk("(%i)\n", names); | 295 | printk("(%i)\n", names); |
286 | return (struct stats) { names, space, 1 }; | 296 | return (struct stats) { names, space, 1 }; |
@@ -547,14 +557,6 @@ static int ext3_htree_next_block(struct inode *dir, __u32 hash, | |||
547 | 557 | ||
548 | 558 | ||
549 | /* | 559 | /* |
550 | * p is at least 6 bytes before the end of page | ||
551 | */ | ||
552 | static inline struct ext3_dir_entry_2 *ext3_next_entry(struct ext3_dir_entry_2 *p) | ||
553 | { | ||
554 | return (struct ext3_dir_entry_2 *)((char*)p + le16_to_cpu(p->rec_len)); | ||
555 | } | ||
556 | |||
557 | /* | ||
558 | * This function fills a red-black tree with information from a | 560 | * This function fills a red-black tree with information from a |
559 | * directory block. It returns the number directory entries loaded | 561 | * directory block. It returns the number directory entries loaded |
560 | * into the tree. If there is an error it is returned in err. | 562 | * into the tree. If there is an error it is returned in err. |
@@ -720,7 +722,7 @@ static int dx_make_map (struct ext3_dir_entry_2 *de, int size, | |||
720 | cond_resched(); | 722 | cond_resched(); |
721 | } | 723 | } |
722 | /* XXX: do we need to check rec_len == 0 case? -Chris */ | 724 | /* XXX: do we need to check rec_len == 0 case? -Chris */ |
723 | de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len)); | 725 | de = ext3_next_entry(de); |
724 | } | 726 | } |
725 | return count; | 727 | return count; |
726 | } | 728 | } |
@@ -822,7 +824,7 @@ static inline int search_dirblock(struct buffer_head * bh, | |||
822 | return 1; | 824 | return 1; |
823 | } | 825 | } |
824 | /* prevent looping on a bad block */ | 826 | /* prevent looping on a bad block */ |
825 | de_len = le16_to_cpu(de->rec_len); | 827 | de_len = ext3_rec_len_from_disk(de->rec_len); |
826 | if (de_len <= 0) | 828 | if (de_len <= 0) |
827 | return -1; | 829 | return -1; |
828 | offset += de_len; | 830 | offset += de_len; |
@@ -1130,7 +1132,7 @@ dx_move_dirents(char *from, char *to, struct dx_map_entry *map, int count) | |||
1130 | rec_len = EXT3_DIR_REC_LEN(de->name_len); | 1132 | rec_len = EXT3_DIR_REC_LEN(de->name_len); |
1131 | memcpy (to, de, rec_len); | 1133 | memcpy (to, de, rec_len); |
1132 | ((struct ext3_dir_entry_2 *) to)->rec_len = | 1134 | ((struct ext3_dir_entry_2 *) to)->rec_len = |
1133 | cpu_to_le16(rec_len); | 1135 | ext3_rec_len_to_disk(rec_len); |
1134 | de->inode = 0; | 1136 | de->inode = 0; |
1135 | map++; | 1137 | map++; |
1136 | to += rec_len; | 1138 | to += rec_len; |
@@ -1149,13 +1151,12 @@ static struct ext3_dir_entry_2* dx_pack_dirents(char *base, int size) | |||
1149 | 1151 | ||
1150 | prev = to = de; | 1152 | prev = to = de; |
1151 | while ((char*)de < base + size) { | 1153 | while ((char*)de < base + size) { |
1152 | next = (struct ext3_dir_entry_2 *) ((char *) de + | 1154 | next = ext3_next_entry(de); |
1153 | le16_to_cpu(de->rec_len)); | ||
1154 | if (de->inode && de->name_len) { | 1155 | if (de->inode && de->name_len) { |
1155 | rec_len = EXT3_DIR_REC_LEN(de->name_len); | 1156 | rec_len = EXT3_DIR_REC_LEN(de->name_len); |
1156 | if (de > to) | 1157 | if (de > to) |
1157 | memmove(to, de, rec_len); | 1158 | memmove(to, de, rec_len); |
1158 | to->rec_len = cpu_to_le16(rec_len); | 1159 | to->rec_len = ext3_rec_len_to_disk(rec_len); |
1159 | prev = to; | 1160 | prev = to; |
1160 | to = (struct ext3_dir_entry_2 *) (((char *) to) + rec_len); | 1161 | to = (struct ext3_dir_entry_2 *) (((char *) to) + rec_len); |
1161 | } | 1162 | } |
@@ -1229,8 +1230,8 @@ static struct ext3_dir_entry_2 *do_split(handle_t *handle, struct inode *dir, | |||
1229 | /* Fancy dance to stay within two buffers */ | 1230 | /* Fancy dance to stay within two buffers */ |
1230 | de2 = dx_move_dirents(data1, data2, map + split, count - split); | 1231 | de2 = dx_move_dirents(data1, data2, map + split, count - split); |
1231 | de = dx_pack_dirents(data1,blocksize); | 1232 | de = dx_pack_dirents(data1,blocksize); |
1232 | de->rec_len = cpu_to_le16(data1 + blocksize - (char *) de); | 1233 | de->rec_len = ext3_rec_len_to_disk(data1 + blocksize - (char *) de); |
1233 | de2->rec_len = cpu_to_le16(data2 + blocksize - (char *) de2); | 1234 | de2->rec_len = ext3_rec_len_to_disk(data2 + blocksize - (char *) de2); |
1234 | dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data1, blocksize, 1)); | 1235 | dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data1, blocksize, 1)); |
1235 | dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data2, blocksize, 1)); | 1236 | dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data2, blocksize, 1)); |
1236 | 1237 | ||
@@ -1300,7 +1301,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | |||
1300 | return -EEXIST; | 1301 | return -EEXIST; |
1301 | } | 1302 | } |
1302 | nlen = EXT3_DIR_REC_LEN(de->name_len); | 1303 | nlen = EXT3_DIR_REC_LEN(de->name_len); |
1303 | rlen = le16_to_cpu(de->rec_len); | 1304 | rlen = ext3_rec_len_from_disk(de->rec_len); |
1304 | if ((de->inode? rlen - nlen: rlen) >= reclen) | 1305 | if ((de->inode? rlen - nlen: rlen) >= reclen) |
1305 | break; | 1306 | break; |
1306 | de = (struct ext3_dir_entry_2 *)((char *)de + rlen); | 1307 | de = (struct ext3_dir_entry_2 *)((char *)de + rlen); |
@@ -1319,11 +1320,11 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | |||
1319 | 1320 | ||
1320 | /* By now the buffer is marked for journaling */ | 1321 | /* By now the buffer is marked for journaling */ |
1321 | nlen = EXT3_DIR_REC_LEN(de->name_len); | 1322 | nlen = EXT3_DIR_REC_LEN(de->name_len); |
1322 | rlen = le16_to_cpu(de->rec_len); | 1323 | rlen = ext3_rec_len_from_disk(de->rec_len); |
1323 | if (de->inode) { | 1324 | if (de->inode) { |
1324 | struct ext3_dir_entry_2 *de1 = (struct ext3_dir_entry_2 *)((char *)de + nlen); | 1325 | struct ext3_dir_entry_2 *de1 = (struct ext3_dir_entry_2 *)((char *)de + nlen); |
1325 | de1->rec_len = cpu_to_le16(rlen - nlen); | 1326 | de1->rec_len = ext3_rec_len_to_disk(rlen - nlen); |
1326 | de->rec_len = cpu_to_le16(nlen); | 1327 | de->rec_len = ext3_rec_len_to_disk(nlen); |
1327 | de = de1; | 1328 | de = de1; |
1328 | } | 1329 | } |
1329 | de->file_type = EXT3_FT_UNKNOWN; | 1330 | de->file_type = EXT3_FT_UNKNOWN; |
@@ -1400,17 +1401,18 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | |||
1400 | 1401 | ||
1401 | /* The 0th block becomes the root, move the dirents out */ | 1402 | /* The 0th block becomes the root, move the dirents out */ |
1402 | fde = &root->dotdot; | 1403 | fde = &root->dotdot; |
1403 | de = (struct ext3_dir_entry_2 *)((char *)fde + le16_to_cpu(fde->rec_len)); | 1404 | de = (struct ext3_dir_entry_2 *)((char *)fde + |
1405 | ext3_rec_len_from_disk(fde->rec_len)); | ||
1404 | len = ((char *) root) + blocksize - (char *) de; | 1406 | len = ((char *) root) + blocksize - (char *) de; |
1405 | memcpy (data1, de, len); | 1407 | memcpy (data1, de, len); |
1406 | de = (struct ext3_dir_entry_2 *) data1; | 1408 | de = (struct ext3_dir_entry_2 *) data1; |
1407 | top = data1 + len; | 1409 | top = data1 + len; |
1408 | while ((char *)(de2=(void*)de+le16_to_cpu(de->rec_len)) < top) | 1410 | while ((char *)(de2 = ext3_next_entry(de)) < top) |
1409 | de = de2; | 1411 | de = de2; |
1410 | de->rec_len = cpu_to_le16(data1 + blocksize - (char *) de); | 1412 | de->rec_len = ext3_rec_len_to_disk(data1 + blocksize - (char *) de); |
1411 | /* Initialize the root; the dot dirents already exist */ | 1413 | /* Initialize the root; the dot dirents already exist */ |
1412 | de = (struct ext3_dir_entry_2 *) (&root->dotdot); | 1414 | de = (struct ext3_dir_entry_2 *) (&root->dotdot); |
1413 | de->rec_len = cpu_to_le16(blocksize - EXT3_DIR_REC_LEN(2)); | 1415 | de->rec_len = ext3_rec_len_to_disk(blocksize - EXT3_DIR_REC_LEN(2)); |
1414 | memset (&root->info, 0, sizeof(root->info)); | 1416 | memset (&root->info, 0, sizeof(root->info)); |
1415 | root->info.info_length = sizeof(root->info); | 1417 | root->info.info_length = sizeof(root->info); |
1416 | root->info.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; | 1418 | root->info.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; |
@@ -1490,7 +1492,7 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry, | |||
1490 | return retval; | 1492 | return retval; |
1491 | de = (struct ext3_dir_entry_2 *) bh->b_data; | 1493 | de = (struct ext3_dir_entry_2 *) bh->b_data; |
1492 | de->inode = 0; | 1494 | de->inode = 0; |
1493 | de->rec_len = cpu_to_le16(blocksize); | 1495 | de->rec_len = ext3_rec_len_to_disk(blocksize); |
1494 | return add_dirent_to_buf(handle, dentry, inode, de, bh); | 1496 | return add_dirent_to_buf(handle, dentry, inode, de, bh); |
1495 | } | 1497 | } |
1496 | 1498 | ||
@@ -1553,7 +1555,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, | |||
1553 | goto cleanup; | 1555 | goto cleanup; |
1554 | node2 = (struct dx_node *)(bh2->b_data); | 1556 | node2 = (struct dx_node *)(bh2->b_data); |
1555 | entries2 = node2->entries; | 1557 | entries2 = node2->entries; |
1556 | node2->fake.rec_len = cpu_to_le16(sb->s_blocksize); | 1558 | node2->fake.rec_len = ext3_rec_len_to_disk(sb->s_blocksize); |
1557 | node2->fake.inode = 0; | 1559 | node2->fake.inode = 0; |
1558 | BUFFER_TRACE(frame->bh, "get_write_access"); | 1560 | BUFFER_TRACE(frame->bh, "get_write_access"); |
1559 | err = ext3_journal_get_write_access(handle, frame->bh); | 1561 | err = ext3_journal_get_write_access(handle, frame->bh); |
@@ -1651,9 +1653,9 @@ static int ext3_delete_entry (handle_t *handle, | |||
1651 | BUFFER_TRACE(bh, "get_write_access"); | 1653 | BUFFER_TRACE(bh, "get_write_access"); |
1652 | ext3_journal_get_write_access(handle, bh); | 1654 | ext3_journal_get_write_access(handle, bh); |
1653 | if (pde) | 1655 | if (pde) |
1654 | pde->rec_len = | 1656 | pde->rec_len = ext3_rec_len_to_disk( |
1655 | cpu_to_le16(le16_to_cpu(pde->rec_len) + | 1657 | ext3_rec_len_from_disk(pde->rec_len) + |
1656 | le16_to_cpu(de->rec_len)); | 1658 | ext3_rec_len_from_disk(de->rec_len)); |
1657 | else | 1659 | else |
1658 | de->inode = 0; | 1660 | de->inode = 0; |
1659 | dir->i_version++; | 1661 | dir->i_version++; |
@@ -1661,10 +1663,9 @@ static int ext3_delete_entry (handle_t *handle, | |||
1661 | ext3_journal_dirty_metadata(handle, bh); | 1663 | ext3_journal_dirty_metadata(handle, bh); |
1662 | return 0; | 1664 | return 0; |
1663 | } | 1665 | } |
1664 | i += le16_to_cpu(de->rec_len); | 1666 | i += ext3_rec_len_from_disk(de->rec_len); |
1665 | pde = de; | 1667 | pde = de; |
1666 | de = (struct ext3_dir_entry_2 *) | 1668 | de = ext3_next_entry(de); |
1667 | ((char *) de + le16_to_cpu(de->rec_len)); | ||
1668 | } | 1669 | } |
1669 | return -ENOENT; | 1670 | return -ENOENT; |
1670 | } | 1671 | } |
@@ -1798,13 +1799,13 @@ retry: | |||
1798 | de = (struct ext3_dir_entry_2 *) dir_block->b_data; | 1799 | de = (struct ext3_dir_entry_2 *) dir_block->b_data; |
1799 | de->inode = cpu_to_le32(inode->i_ino); | 1800 | de->inode = cpu_to_le32(inode->i_ino); |
1800 | de->name_len = 1; | 1801 | de->name_len = 1; |
1801 | de->rec_len = cpu_to_le16(EXT3_DIR_REC_LEN(de->name_len)); | 1802 | de->rec_len = ext3_rec_len_to_disk(EXT3_DIR_REC_LEN(de->name_len)); |
1802 | strcpy (de->name, "."); | 1803 | strcpy (de->name, "."); |
1803 | ext3_set_de_type(dir->i_sb, de, S_IFDIR); | 1804 | ext3_set_de_type(dir->i_sb, de, S_IFDIR); |
1804 | de = (struct ext3_dir_entry_2 *) | 1805 | de = ext3_next_entry(de); |
1805 | ((char *) de + le16_to_cpu(de->rec_len)); | ||
1806 | de->inode = cpu_to_le32(dir->i_ino); | 1806 | de->inode = cpu_to_le32(dir->i_ino); |
1807 | de->rec_len = cpu_to_le16(inode->i_sb->s_blocksize-EXT3_DIR_REC_LEN(1)); | 1807 | de->rec_len = ext3_rec_len_to_disk(inode->i_sb->s_blocksize - |
1808 | EXT3_DIR_REC_LEN(1)); | ||
1808 | de->name_len = 2; | 1809 | de->name_len = 2; |
1809 | strcpy (de->name, ".."); | 1810 | strcpy (de->name, ".."); |
1810 | ext3_set_de_type(dir->i_sb, de, S_IFDIR); | 1811 | ext3_set_de_type(dir->i_sb, de, S_IFDIR); |
@@ -1856,8 +1857,7 @@ static int empty_dir (struct inode * inode) | |||
1856 | return 1; | 1857 | return 1; |
1857 | } | 1858 | } |
1858 | de = (struct ext3_dir_entry_2 *) bh->b_data; | 1859 | de = (struct ext3_dir_entry_2 *) bh->b_data; |
1859 | de1 = (struct ext3_dir_entry_2 *) | 1860 | de1 = ext3_next_entry(de); |
1860 | ((char *) de + le16_to_cpu(de->rec_len)); | ||
1861 | if (le32_to_cpu(de->inode) != inode->i_ino || | 1861 | if (le32_to_cpu(de->inode) != inode->i_ino || |
1862 | !le32_to_cpu(de1->inode) || | 1862 | !le32_to_cpu(de1->inode) || |
1863 | strcmp (".", de->name) || | 1863 | strcmp (".", de->name) || |
@@ -1868,9 +1868,9 @@ static int empty_dir (struct inode * inode) | |||
1868 | brelse (bh); | 1868 | brelse (bh); |
1869 | return 1; | 1869 | return 1; |
1870 | } | 1870 | } |
1871 | offset = le16_to_cpu(de->rec_len) + le16_to_cpu(de1->rec_len); | 1871 | offset = ext3_rec_len_from_disk(de->rec_len) + |
1872 | de = (struct ext3_dir_entry_2 *) | 1872 | ext3_rec_len_from_disk(de1->rec_len); |
1873 | ((char *) de1 + le16_to_cpu(de1->rec_len)); | 1873 | de = ext3_next_entry(de1); |
1874 | while (offset < inode->i_size ) { | 1874 | while (offset < inode->i_size ) { |
1875 | if (!bh || | 1875 | if (!bh || |
1876 | (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { | 1876 | (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { |
@@ -1899,9 +1899,8 @@ static int empty_dir (struct inode * inode) | |||
1899 | brelse (bh); | 1899 | brelse (bh); |
1900 | return 0; | 1900 | return 0; |
1901 | } | 1901 | } |
1902 | offset += le16_to_cpu(de->rec_len); | 1902 | offset += ext3_rec_len_from_disk(de->rec_len); |
1903 | de = (struct ext3_dir_entry_2 *) | 1903 | de = ext3_next_entry(de); |
1904 | ((char *) de + le16_to_cpu(de->rec_len)); | ||
1905 | } | 1904 | } |
1906 | brelse (bh); | 1905 | brelse (bh); |
1907 | return 1; | 1906 | return 1; |
@@ -2255,8 +2254,7 @@ retry: | |||
2255 | } | 2254 | } |
2256 | 2255 | ||
2257 | #define PARENT_INO(buffer) \ | 2256 | #define PARENT_INO(buffer) \ |
2258 | ((struct ext3_dir_entry_2 *) ((char *) buffer + \ | 2257 | (ext3_next_entry((struct ext3_dir_entry_2 *)(buffer))->inode) |
2259 | le16_to_cpu(((struct ext3_dir_entry_2 *) buffer)->rec_len)))->inode | ||
2260 | 2258 | ||
2261 | /* | 2259 | /* |
2262 | * Anybody can rename anything with this: the permission checks are left to the | 2260 | * Anybody can rename anything with this: the permission checks are left to the |
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index c04c7ccba9e3..e7f894bdb420 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -51,6 +51,11 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
51 | flags &= ~EXT4_DIRSYNC_FL; | 51 | flags &= ~EXT4_DIRSYNC_FL; |
52 | 52 | ||
53 | mutex_lock(&inode->i_mutex); | 53 | mutex_lock(&inode->i_mutex); |
54 | /* Is it quota file? Do not allow user to mess with it */ | ||
55 | if (IS_NOQUOTA(inode)) { | ||
56 | mutex_unlock(&inode->i_mutex); | ||
57 | return -EPERM; | ||
58 | } | ||
54 | oldflags = ei->i_flags; | 59 | oldflags = ei->i_flags; |
55 | 60 | ||
56 | /* The JOURNAL_DATA flag is modifiable only by root */ | 61 | /* The JOURNAL_DATA flag is modifiable only by root */ |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 0fcdba9d47c0..535b37399009 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -55,9 +55,10 @@ struct fuse_file *fuse_file_alloc(void) | |||
55 | if (!ff->reserved_req) { | 55 | if (!ff->reserved_req) { |
56 | kfree(ff); | 56 | kfree(ff); |
57 | ff = NULL; | 57 | ff = NULL; |
58 | } else { | ||
59 | INIT_LIST_HEAD(&ff->write_entry); | ||
60 | atomic_set(&ff->count, 0); | ||
58 | } | 61 | } |
59 | INIT_LIST_HEAD(&ff->write_entry); | ||
60 | atomic_set(&ff->count, 0); | ||
61 | } | 62 | } |
62 | return ff; | 63 | return ff; |
63 | } | 64 | } |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 12aca8ed605f..09ee07f02663 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -364,7 +364,6 @@ static void truncate_hugepages(struct inode *inode, loff_t lstart) | |||
364 | ++next; | 364 | ++next; |
365 | truncate_huge_page(page); | 365 | truncate_huge_page(page); |
366 | unlock_page(page); | 366 | unlock_page(page); |
367 | hugetlb_put_quota(mapping); | ||
368 | freed++; | 367 | freed++; |
369 | } | 368 | } |
370 | huge_pagevec_release(&pvec); | 369 | huge_pagevec_release(&pvec); |
@@ -859,15 +858,15 @@ out_free: | |||
859 | return -ENOMEM; | 858 | return -ENOMEM; |
860 | } | 859 | } |
861 | 860 | ||
862 | int hugetlb_get_quota(struct address_space *mapping) | 861 | int hugetlb_get_quota(struct address_space *mapping, long delta) |
863 | { | 862 | { |
864 | int ret = 0; | 863 | int ret = 0; |
865 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); | 864 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); |
866 | 865 | ||
867 | if (sbinfo->free_blocks > -1) { | 866 | if (sbinfo->free_blocks > -1) { |
868 | spin_lock(&sbinfo->stat_lock); | 867 | spin_lock(&sbinfo->stat_lock); |
869 | if (sbinfo->free_blocks > 0) | 868 | if (sbinfo->free_blocks - delta >= 0) |
870 | sbinfo->free_blocks--; | 869 | sbinfo->free_blocks -= delta; |
871 | else | 870 | else |
872 | ret = -ENOMEM; | 871 | ret = -ENOMEM; |
873 | spin_unlock(&sbinfo->stat_lock); | 872 | spin_unlock(&sbinfo->stat_lock); |
@@ -876,13 +875,13 @@ int hugetlb_get_quota(struct address_space *mapping) | |||
876 | return ret; | 875 | return ret; |
877 | } | 876 | } |
878 | 877 | ||
879 | void hugetlb_put_quota(struct address_space *mapping) | 878 | void hugetlb_put_quota(struct address_space *mapping, long delta) |
880 | { | 879 | { |
881 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); | 880 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); |
882 | 881 | ||
883 | if (sbinfo->free_blocks > -1) { | 882 | if (sbinfo->free_blocks > -1) { |
884 | spin_lock(&sbinfo->stat_lock); | 883 | spin_lock(&sbinfo->stat_lock); |
885 | sbinfo->free_blocks++; | 884 | sbinfo->free_blocks += delta; |
886 | spin_unlock(&sbinfo->stat_lock); | 885 | spin_unlock(&sbinfo->stat_lock); |
887 | } | 886 | } |
888 | } | 887 | } |
diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c index 3c8663bea98c..dfda12a073e1 100644 --- a/fs/jfs/ioctl.c +++ b/fs/jfs/ioctl.c | |||
@@ -79,6 +79,9 @@ int jfs_ioctl(struct inode * inode, struct file * filp, unsigned int cmd, | |||
79 | if (!S_ISDIR(inode->i_mode)) | 79 | if (!S_ISDIR(inode->i_mode)) |
80 | flags &= ~JFS_DIRSYNC_FL; | 80 | flags &= ~JFS_DIRSYNC_FL; |
81 | 81 | ||
82 | /* Is it quota file? Do not allow user to mess with it */ | ||
83 | if (IS_NOQUOTA(inode)) | ||
84 | return -EPERM; | ||
82 | jfs_get_inode_flags(jfs_inode); | 85 | jfs_get_inode_flags(jfs_inode); |
83 | oldflags = jfs_inode->mode2; | 86 | oldflags = jfs_inode->mode2; |
84 | 87 | ||
@@ -1061,7 +1061,7 @@ asmlinkage long sys_open(const char __user *filename, int flags, int mode) | |||
1061 | prevent_tail_call(ret); | 1061 | prevent_tail_call(ret); |
1062 | return ret; | 1062 | return ret; |
1063 | } | 1063 | } |
1064 | EXPORT_SYMBOL_GPL(sys_open); | 1064 | EXPORT_UNUSED_SYMBOL_GPL(sys_open); /* To be deleted for 2.6.25 */ |
1065 | 1065 | ||
1066 | asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, | 1066 | asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, |
1067 | int mode) | 1067 | int mode) |
diff --git a/fs/proc/base.c b/fs/proc/base.c index aeaf0d0f2f51..a17c26859074 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2328,21 +2328,18 @@ out: | |||
2328 | 2328 | ||
2329 | void proc_flush_task(struct task_struct *task) | 2329 | void proc_flush_task(struct task_struct *task) |
2330 | { | 2330 | { |
2331 | int i, leader; | 2331 | int i; |
2332 | struct pid *pid, *tgid; | 2332 | struct pid *pid, *tgid = NULL; |
2333 | struct upid *upid; | 2333 | struct upid *upid; |
2334 | 2334 | ||
2335 | leader = thread_group_leader(task); | ||
2336 | proc_flush_task_mnt(proc_mnt, task->pid, leader ? task->tgid : 0); | ||
2337 | pid = task_pid(task); | 2335 | pid = task_pid(task); |
2338 | if (pid->level == 0) | 2336 | if (thread_group_leader(task)) |
2339 | return; | 2337 | tgid = task_tgid(task); |
2340 | 2338 | ||
2341 | tgid = task_tgid(task); | 2339 | for (i = 0; i <= pid->level; i++) { |
2342 | for (i = 1; i <= pid->level; i++) { | ||
2343 | upid = &pid->numbers[i]; | 2340 | upid = &pid->numbers[i]; |
2344 | proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr, | 2341 | proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr, |
2345 | leader ? 0 : tgid->numbers[i].nr); | 2342 | tgid ? tgid->numbers[i].nr : 0); |
2346 | } | 2343 | } |
2347 | 2344 | ||
2348 | upid = &pid->numbers[pid->level]; | 2345 | upid = &pid->numbers[pid->level]; |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 1bdb62435758..a9806bc21ec3 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -561,28 +561,33 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp | |||
561 | static void proc_kill_inodes(struct proc_dir_entry *de) | 561 | static void proc_kill_inodes(struct proc_dir_entry *de) |
562 | { | 562 | { |
563 | struct list_head *p; | 563 | struct list_head *p; |
564 | struct super_block *sb = proc_mnt->mnt_sb; | 564 | struct super_block *sb; |
565 | 565 | ||
566 | /* | 566 | /* |
567 | * Actually it's a partial revoke(). | 567 | * Actually it's a partial revoke(). |
568 | */ | 568 | */ |
569 | file_list_lock(); | 569 | spin_lock(&sb_lock); |
570 | list_for_each(p, &sb->s_files) { | 570 | list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) { |
571 | struct file * filp = list_entry(p, struct file, f_u.fu_list); | 571 | file_list_lock(); |
572 | struct dentry * dentry = filp->f_path.dentry; | 572 | list_for_each(p, &sb->s_files) { |
573 | struct inode * inode; | 573 | struct file *filp = list_entry(p, struct file, |
574 | const struct file_operations *fops; | 574 | f_u.fu_list); |
575 | 575 | struct dentry *dentry = filp->f_path.dentry; | |
576 | if (dentry->d_op != &proc_dentry_operations) | 576 | struct inode *inode; |
577 | continue; | 577 | const struct file_operations *fops; |
578 | inode = dentry->d_inode; | 578 | |
579 | if (PDE(inode) != de) | 579 | if (dentry->d_op != &proc_dentry_operations) |
580 | continue; | 580 | continue; |
581 | fops = filp->f_op; | 581 | inode = dentry->d_inode; |
582 | filp->f_op = NULL; | 582 | if (PDE(inode) != de) |
583 | fops_put(fops); | 583 | continue; |
584 | fops = filp->f_op; | ||
585 | filp->f_op = NULL; | ||
586 | fops_put(fops); | ||
587 | } | ||
588 | file_list_unlock(); | ||
584 | } | 589 | } |
585 | file_list_unlock(); | 590 | spin_unlock(&sb_lock); |
586 | } | 591 | } |
587 | 592 | ||
588 | static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, | 593 | static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 1820eb2ef762..1b2b6c6bb475 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -78,3 +78,5 @@ static inline int proc_fd(struct inode *inode) | |||
78 | { | 78 | { |
79 | return PROC_I(inode)->fd; | 79 | return PROC_I(inode)->fd; |
80 | } | 80 | } |
81 | |||
82 | extern struct file_system_type proc_fs_type; | ||
diff --git a/fs/proc/root.c b/fs/proc/root.c index ec9cb3b6c93b..1f86bb860e04 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb) | |||
98 | put_pid_ns(ns); | 98 | put_pid_ns(ns); |
99 | } | 99 | } |
100 | 100 | ||
101 | static struct file_system_type proc_fs_type = { | 101 | struct file_system_type proc_fs_type = { |
102 | .name = "proc", | 102 | .name = "proc", |
103 | .get_sb = proc_get_sb, | 103 | .get_sb = proc_get_sb, |
104 | .kill_sb = proc_kill_sb, | 104 | .kill_sb = proc_kill_sb, |
diff --git a/fs/read_write.c b/fs/read_write.c index 124693e8d3fa..ea1f94cc722e 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -370,7 +370,7 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count) | |||
370 | 370 | ||
371 | return ret; | 371 | return ret; |
372 | } | 372 | } |
373 | EXPORT_SYMBOL_GPL(sys_read); | 373 | EXPORT_UNUSED_SYMBOL_GPL(sys_read); /* to be deleted for 2.6.25 */ |
374 | 374 | ||
375 | asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count) | 375 | asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count) |
376 | { | 376 | { |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index c438a8f83f26..e0f0f098a523 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -57,6 +57,9 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | |||
57 | if (get_user(flags, (int __user *)arg)) | 57 | if (get_user(flags, (int __user *)arg)) |
58 | return -EFAULT; | 58 | return -EFAULT; |
59 | 59 | ||
60 | /* Is it quota file? Do not allow user to mess with it. */ | ||
61 | if (IS_NOQUOTA(inode)) | ||
62 | return -EPERM; | ||
60 | if (((flags ^ REISERFS_I(inode)-> | 63 | if (((flags ^ REISERFS_I(inode)-> |
61 | i_attrs) & (REISERFS_IMMUTABLE_FL | | 64 | i_attrs) & (REISERFS_IMMUTABLE_FL | |
62 | REISERFS_APPEND_FL)) | 65 | REISERFS_APPEND_FL)) |
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index ca41567d7890..d2db2417b2bd 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -1458,9 +1458,6 @@ static void unmap_buffers(struct page *page, loff_t pos) | |||
1458 | } | 1458 | } |
1459 | bh = next; | 1459 | bh = next; |
1460 | } while (bh != head); | 1460 | } while (bh != head); |
1461 | if (PAGE_SIZE == bh->b_size) { | ||
1462 | cancel_dirty_page(page, PAGE_CACHE_SIZE); | ||
1463 | } | ||
1464 | } | 1461 | } |
1465 | } | 1462 | } |
1466 | } | 1463 | } |
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c index f5d14cebc75a..efbe29af3d7a 100644 --- a/fs/smbfs/file.c +++ b/fs/smbfs/file.c | |||
@@ -234,7 +234,7 @@ smb_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
234 | 234 | ||
235 | VERBOSE("before read, size=%ld, flags=%x, atime=%ld\n", | 235 | VERBOSE("before read, size=%ld, flags=%x, atime=%ld\n", |
236 | (long)dentry->d_inode->i_size, | 236 | (long)dentry->d_inode->i_size, |
237 | dentry->d_inode->i_flags, dentry->d_inode->i_atime); | 237 | dentry->d_inode->i_flags, dentry->d_inode->i_atime.tv_sec); |
238 | 238 | ||
239 | status = generic_file_aio_read(iocb, iov, nr_segs, pos); | 239 | status = generic_file_aio_read(iocb, iov, nr_segs, pos); |
240 | out: | 240 | out: |
@@ -269,7 +269,7 @@ smb_file_splice_read(struct file *file, loff_t *ppos, | |||
269 | struct dentry *dentry = file->f_path.dentry; | 269 | struct dentry *dentry = file->f_path.dentry; |
270 | ssize_t status; | 270 | ssize_t status; |
271 | 271 | ||
272 | VERBOSE("file %s/%s, pos=%Ld, count=%d\n", | 272 | VERBOSE("file %s/%s, pos=%Ld, count=%lu\n", |
273 | DENTRY_PATH(dentry), *ppos, count); | 273 | DENTRY_PATH(dentry), *ppos, count); |
274 | 274 | ||
275 | status = smb_revalidate_inode(dentry); | 275 | status = smb_revalidate_inode(dentry); |
@@ -363,7 +363,8 @@ smb_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
363 | result = generic_file_aio_write(iocb, iov, nr_segs, pos); | 363 | result = generic_file_aio_write(iocb, iov, nr_segs, pos); |
364 | VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n", | 364 | VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n", |
365 | (long) file->f_pos, (long) dentry->d_inode->i_size, | 365 | (long) file->f_pos, (long) dentry->d_inode->i_size, |
366 | dentry->d_inode->i_mtime, dentry->d_inode->i_atime); | 366 | dentry->d_inode->i_mtime.tv_sec, |
367 | dentry->d_inode->i_atime.tv_sec); | ||
367 | } | 368 | } |
368 | out: | 369 | out: |
369 | return result; | 370 | return result; |
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index ab517755ece0..9416ead0c7aa 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -536,7 +536,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
536 | 536 | ||
537 | /* Allocate the global temp buffer and some superblock helper structs */ | 537 | /* Allocate the global temp buffer and some superblock helper structs */ |
538 | /* FIXME: move these to the smb_sb_info struct */ | 538 | /* FIXME: move these to the smb_sb_info struct */ |
539 | VERBOSE("alloc chunk = %d\n", sizeof(struct smb_ops) + | 539 | VERBOSE("alloc chunk = %lu\n", sizeof(struct smb_ops) + |
540 | sizeof(struct smb_mount_data_kernel)); | 540 | sizeof(struct smb_mount_data_kernel)); |
541 | mem = kmalloc(sizeof(struct smb_ops) + | 541 | mem = kmalloc(sizeof(struct smb_ops) + |
542 | sizeof(struct smb_mount_data_kernel), GFP_KERNEL); | 542 | sizeof(struct smb_mount_data_kernel), GFP_KERNEL); |
diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c index feac46050619..d517a27b7f4b 100644 --- a/fs/smbfs/proc.c +++ b/fs/smbfs/proc.c | |||
@@ -2593,7 +2593,7 @@ smb_proc_getattr_ff(struct smb_sb_info *server, struct dentry *dentry, | |||
2593 | fattr->f_mtime.tv_sec = date_dos2unix(server, date, time); | 2593 | fattr->f_mtime.tv_sec = date_dos2unix(server, date, time); |
2594 | fattr->f_mtime.tv_nsec = 0; | 2594 | fattr->f_mtime.tv_nsec = 0; |
2595 | VERBOSE("name=%s, date=%x, time=%x, mtime=%ld\n", | 2595 | VERBOSE("name=%s, date=%x, time=%x, mtime=%ld\n", |
2596 | mask, date, time, fattr->f_mtime); | 2596 | mask, date, time, fattr->f_mtime.tv_sec); |
2597 | fattr->f_size = DVAL(req->rq_data, 12); | 2597 | fattr->f_size = DVAL(req->rq_data, 12); |
2598 | /* ULONG allocation size */ | 2598 | /* ULONG allocation size */ |
2599 | fattr->attr = WVAL(req->rq_data, 20); | 2599 | fattr->attr = WVAL(req->rq_data, 20); |
diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index 283c5720c9de..fae8e85af0ed 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c | |||
@@ -227,7 +227,7 @@ int smbiod_retry(struct smb_sb_info *server) | |||
227 | printk(KERN_ERR "smb_retry: signal failed [%d]\n", result); | 227 | printk(KERN_ERR "smb_retry: signal failed [%d]\n", result); |
228 | goto out; | 228 | goto out; |
229 | } | 229 | } |
230 | VERBOSE("signalled pid %d\n", pid); | 230 | VERBOSE("signalled pid %d\n", pid_nr(pid)); |
231 | 231 | ||
232 | /* FIXME: The retried requests should perhaps get a "time boost". */ | 232 | /* FIXME: The retried requests should perhaps get a "time boost". */ |
233 | 233 | ||