diff options
author | Nick Piggin <npiggin@suse.de> | 2007-10-16 04:25:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:42:57 -0400 |
commit | 4a66af9eaa9531372cfcb9e20103ed147c729ff9 (patch) | |
tree | 8c766cdab76be6369e450b783c61d168e8374762 /fs/minix/dir.c | |
parent | 26a6441aadde864132672750b3cf0892e5acaaf4 (diff) |
minixfs: convert to new aops
Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Andries Brouwer <Andries.Brouwer@cwi.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/minix/dir.c')
-rw-r--r-- | fs/minix/dir.c | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/fs/minix/dir.c b/fs/minix/dir.c index e207cbe7095..f70433816a3 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c | |||
@@ -9,8 +9,10 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include "minix.h" | 11 | #include "minix.h" |
12 | #include <linux/buffer_head.h> | ||
12 | #include <linux/highmem.h> | 13 | #include <linux/highmem.h> |
13 | #include <linux/smp_lock.h> | 14 | #include <linux/smp_lock.h> |
15 | #include <linux/swap.h> | ||
14 | 16 | ||
15 | typedef struct minix_dir_entry minix_dirent; | 17 | typedef struct minix_dir_entry minix_dirent; |
16 | typedef struct minix3_dir_entry minix3_dirent; | 18 | typedef struct minix3_dir_entry minix3_dirent; |
@@ -48,11 +50,17 @@ static inline unsigned long dir_pages(struct inode *inode) | |||
48 | return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT; | 50 | return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT; |
49 | } | 51 | } |
50 | 52 | ||
51 | static int dir_commit_chunk(struct page *page, unsigned from, unsigned to) | 53 | static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len) |
52 | { | 54 | { |
53 | struct inode *dir = (struct inode *)page->mapping->host; | 55 | struct address_space *mapping = page->mapping; |
56 | struct inode *dir = mapping->host; | ||
54 | int err = 0; | 57 | int err = 0; |
55 | page->mapping->a_ops->commit_write(NULL, page, from, to); | 58 | block_write_end(NULL, mapping, pos, len, len, page, NULL); |
59 | |||
60 | if (pos+len > dir->i_size) { | ||
61 | i_size_write(dir, pos+len); | ||
62 | mark_inode_dirty(dir); | ||
63 | } | ||
56 | if (IS_DIRSYNC(dir)) | 64 | if (IS_DIRSYNC(dir)) |
57 | err = write_one_page(page, 1); | 65 | err = write_one_page(page, 1); |
58 | else | 66 | else |
@@ -220,7 +228,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) | |||
220 | char *kaddr, *p; | 228 | char *kaddr, *p; |
221 | minix_dirent *de; | 229 | minix_dirent *de; |
222 | minix3_dirent *de3; | 230 | minix3_dirent *de3; |
223 | unsigned from, to; | 231 | loff_t pos; |
224 | int err; | 232 | int err; |
225 | char *namx = NULL; | 233 | char *namx = NULL; |
226 | __u32 inumber; | 234 | __u32 inumber; |
@@ -272,9 +280,9 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) | |||
272 | return -EINVAL; | 280 | return -EINVAL; |
273 | 281 | ||
274 | got_it: | 282 | got_it: |
275 | from = p - (char*)page_address(page); | 283 | pos = (page->index >> PAGE_CACHE_SHIFT) + p - (char*)page_address(page); |
276 | to = from + sbi->s_dirsize; | 284 | err = __minix_write_begin(NULL, page->mapping, pos, sbi->s_dirsize, |
277 | err = page->mapping->a_ops->prepare_write(NULL, page, from, to); | 285 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); |
278 | if (err) | 286 | if (err) |
279 | goto out_unlock; | 287 | goto out_unlock; |
280 | memcpy (namx, name, namelen); | 288 | memcpy (namx, name, namelen); |
@@ -285,7 +293,7 @@ got_it: | |||
285 | memset (namx + namelen, 0, sbi->s_dirsize - namelen - 2); | 293 | memset (namx + namelen, 0, sbi->s_dirsize - namelen - 2); |
286 | de->inode = inode->i_ino; | 294 | de->inode = inode->i_ino; |
287 | } | 295 | } |
288 | err = dir_commit_chunk(page, from, to); | 296 | err = dir_commit_chunk(page, pos, sbi->s_dirsize); |
289 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; | 297 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; |
290 | mark_inode_dirty(dir); | 298 | mark_inode_dirty(dir); |
291 | out_put: | 299 | out_put: |
@@ -302,15 +310,16 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page) | |||
302 | struct address_space *mapping = page->mapping; | 310 | struct address_space *mapping = page->mapping; |
303 | struct inode *inode = (struct inode*)mapping->host; | 311 | struct inode *inode = (struct inode*)mapping->host; |
304 | char *kaddr = page_address(page); | 312 | char *kaddr = page_address(page); |
305 | unsigned from = (char*)de - kaddr; | 313 | loff_t pos = page_offset(page) + (char*)de - kaddr; |
306 | unsigned to = from + minix_sb(inode->i_sb)->s_dirsize; | 314 | unsigned len = minix_sb(inode->i_sb)->s_dirsize; |
307 | int err; | 315 | int err; |
308 | 316 | ||
309 | lock_page(page); | 317 | lock_page(page); |
310 | err = mapping->a_ops->prepare_write(NULL, page, from, to); | 318 | err = __minix_write_begin(NULL, mapping, pos, len, |
319 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); | ||
311 | if (err == 0) { | 320 | if (err == 0) { |
312 | de->inode = 0; | 321 | de->inode = 0; |
313 | err = dir_commit_chunk(page, from, to); | 322 | err = dir_commit_chunk(page, pos, len); |
314 | } else { | 323 | } else { |
315 | unlock_page(page); | 324 | unlock_page(page); |
316 | } | 325 | } |
@@ -330,7 +339,8 @@ int minix_make_empty(struct inode *inode, struct inode *dir) | |||
330 | 339 | ||
331 | if (!page) | 340 | if (!page) |
332 | return -ENOMEM; | 341 | return -ENOMEM; |
333 | err = mapping->a_ops->prepare_write(NULL, page, 0, 2 * sbi->s_dirsize); | 342 | err = __minix_write_begin(NULL, mapping, 0, 2 * sbi->s_dirsize, |
343 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); | ||
334 | if (err) { | 344 | if (err) { |
335 | unlock_page(page); | 345 | unlock_page(page); |
336 | goto fail; | 346 | goto fail; |
@@ -421,17 +431,20 @@ not_empty: | |||
421 | void minix_set_link(struct minix_dir_entry *de, struct page *page, | 431 | void minix_set_link(struct minix_dir_entry *de, struct page *page, |
422 | struct inode *inode) | 432 | struct inode *inode) |
423 | { | 433 | { |
424 | struct inode *dir = (struct inode*)page->mapping->host; | 434 | struct address_space *mapping = page->mapping; |
435 | struct inode *dir = mapping->host; | ||
425 | struct minix_sb_info *sbi = minix_sb(dir->i_sb); | 436 | struct minix_sb_info *sbi = minix_sb(dir->i_sb); |
426 | unsigned from = (char *)de-(char*)page_address(page); | 437 | loff_t pos = page_offset(page) + |
427 | unsigned to = from + sbi->s_dirsize; | 438 | (char *)de-(char*)page_address(page); |
428 | int err; | 439 | int err; |
429 | 440 | ||
430 | lock_page(page); | 441 | lock_page(page); |
431 | err = page->mapping->a_ops->prepare_write(NULL, page, from, to); | 442 | |
443 | err = __minix_write_begin(NULL, mapping, pos, sbi->s_dirsize, | ||
444 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); | ||
432 | if (err == 0) { | 445 | if (err == 0) { |
433 | de->inode = inode->i_ino; | 446 | de->inode = inode->i_ino; |
434 | err = dir_commit_chunk(page, from, to); | 447 | err = dir_commit_chunk(page, pos, sbi->s_dirsize); |
435 | } else { | 448 | } else { |
436 | unlock_page(page); | 449 | unlock_page(page); |
437 | } | 450 | } |