diff options
author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2006-01-08 04:02:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-08 23:13:47 -0500 |
commit | 28fd129827b00e12829d48a5290f46277600619b (patch) | |
tree | 38e50e1b88965fec41ea5b36aa557fb5c2b1ca73 /fs/jfs | |
parent | 05eb0b51fb46430050d5873458612f53e0234f2e (diff) |
[PATCH] Fix and add EXPORT_SYMBOL(filemap_write_and_wait)
This patch add EXPORT_SYMBOL(filemap_write_and_wait) and use it.
See mm/filemap.c:
And changes the filemap_write_and_wait() and filemap_write_and_wait_range().
Current filemap_write_and_wait() doesn't wait if filemap_fdatawrite()
returns error. However, even if filemap_fdatawrite() returned an
error, it may have submitted the partially data pages to the device.
(e.g. in the case of -ENOSPC)
<quotation>
Andrew Morton writes,
If filemap_fdatawrite() returns an error, this might be due to some
I/O problem: dead disk, unplugged cable, etc. Given the generally
crappy quality of the kernel's handling of such exceptions, there's a
good chance that the filemap_fdatawait() will get stuck in D state
forever.
</quotation>
So, this patch doesn't wait if filemap_fdatawrite() returns the -EIO.
Trond, could you please review the nfs part? Especially I'm not sure,
nfs must use the "filemap_fdatawrite(inode->i_mapping) == 0", or not.
Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/jfs')
-rw-r--r-- | fs/jfs/jfs_dmap.c | 3 | ||||
-rw-r--r-- | fs/jfs/jfs_imap.c | 6 | ||||
-rw-r--r-- | fs/jfs/jfs_txnmgr.c | 6 | ||||
-rw-r--r-- | fs/jfs/jfs_umount.c | 6 | ||||
-rw-r--r-- | fs/jfs/resize.c | 3 | ||||
-rw-r--r-- | fs/jfs/super.c | 3 |
6 files changed, 9 insertions, 18 deletions
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 68000a50ceb6..2967b7393415 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c | |||
@@ -302,8 +302,7 @@ int dbSync(struct inode *ipbmap) | |||
302 | /* | 302 | /* |
303 | * write out dirty pages of bmap | 303 | * write out dirty pages of bmap |
304 | */ | 304 | */ |
305 | filemap_fdatawrite(ipbmap->i_mapping); | 305 | filemap_write_and_wait(ipbmap->i_mapping); |
306 | filemap_fdatawait(ipbmap->i_mapping); | ||
307 | 306 | ||
308 | diWriteSpecial(ipbmap, 0); | 307 | diWriteSpecial(ipbmap, 0); |
309 | 308 | ||
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 28201b194f53..31b4aa13dd4b 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
@@ -265,8 +265,7 @@ int diSync(struct inode *ipimap) | |||
265 | /* | 265 | /* |
266 | * write out dirty pages of imap | 266 | * write out dirty pages of imap |
267 | */ | 267 | */ |
268 | filemap_fdatawrite(ipimap->i_mapping); | 268 | filemap_write_and_wait(ipimap->i_mapping); |
269 | filemap_fdatawait(ipimap->i_mapping); | ||
270 | 269 | ||
271 | diWriteSpecial(ipimap, 0); | 270 | diWriteSpecial(ipimap, 0); |
272 | 271 | ||
@@ -565,8 +564,7 @@ void diFreeSpecial(struct inode *ip) | |||
565 | jfs_err("diFreeSpecial called with NULL ip!"); | 564 | jfs_err("diFreeSpecial called with NULL ip!"); |
566 | return; | 565 | return; |
567 | } | 566 | } |
568 | filemap_fdatawrite(ip->i_mapping); | 567 | filemap_write_and_wait(ip->i_mapping); |
569 | filemap_fdatawait(ip->i_mapping); | ||
570 | truncate_inode_pages(ip->i_mapping, 0); | 568 | truncate_inode_pages(ip->i_mapping, 0); |
571 | iput(ip); | 569 | iput(ip); |
572 | } | 570 | } |
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index b660c93c92de..2ddb6b892bcf 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c | |||
@@ -1231,10 +1231,8 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1231 | * when we don't need to worry about it at all. | 1231 | * when we don't need to worry about it at all. |
1232 | * | 1232 | * |
1233 | * if ((!S_ISDIR(ip->i_mode)) | 1233 | * if ((!S_ISDIR(ip->i_mode)) |
1234 | * && (tblk->flag & COMMIT_DELETE) == 0) { | 1234 | * && (tblk->flag & COMMIT_DELETE) == 0) |
1235 | * filemap_fdatawrite(ip->i_mapping); | 1235 | * filemap_write_and_wait(ip->i_mapping); |
1236 | * filemap_fdatawait(ip->i_mapping); | ||
1237 | * } | ||
1238 | */ | 1236 | */ |
1239 | 1237 | ||
1240 | /* | 1238 | /* |
diff --git a/fs/jfs/jfs_umount.c b/fs/jfs/jfs_umount.c index 5cf91785b541..21eaf7ac0fcb 100644 --- a/fs/jfs/jfs_umount.c +++ b/fs/jfs/jfs_umount.c | |||
@@ -108,8 +108,7 @@ int jfs_umount(struct super_block *sb) | |||
108 | * Make sure all metadata makes it to disk before we mark | 108 | * Make sure all metadata makes it to disk before we mark |
109 | * the superblock as clean | 109 | * the superblock as clean |
110 | */ | 110 | */ |
111 | filemap_fdatawrite(sbi->direct_inode->i_mapping); | 111 | filemap_write_and_wait(sbi->direct_inode->i_mapping); |
112 | filemap_fdatawait(sbi->direct_inode->i_mapping); | ||
113 | 112 | ||
114 | /* | 113 | /* |
115 | * ensure all file system file pages are propagated to their | 114 | * ensure all file system file pages are propagated to their |
@@ -161,8 +160,7 @@ int jfs_umount_rw(struct super_block *sb) | |||
161 | * mark the superblock clean before everything is flushed to | 160 | * mark the superblock clean before everything is flushed to |
162 | * disk. | 161 | * disk. |
163 | */ | 162 | */ |
164 | filemap_fdatawrite(sbi->direct_inode->i_mapping); | 163 | filemap_write_and_wait(sbi->direct_inode->i_mapping); |
165 | filemap_fdatawait(sbi->direct_inode->i_mapping); | ||
166 | 164 | ||
167 | updateSuper(sb, FM_CLEAN); | 165 | updateSuper(sb, FM_CLEAN); |
168 | 166 | ||
diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c index c6dc254d3253..45180361871c 100644 --- a/fs/jfs/resize.c +++ b/fs/jfs/resize.c | |||
@@ -376,8 +376,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
376 | * by txCommit(); | 376 | * by txCommit(); |
377 | */ | 377 | */ |
378 | filemap_fdatawait(ipbmap->i_mapping); | 378 | filemap_fdatawait(ipbmap->i_mapping); |
379 | filemap_fdatawrite(ipbmap->i_mapping); | 379 | filemap_write_and_wait(ipbmap->i_mapping); |
380 | filemap_fdatawait(ipbmap->i_mapping); | ||
381 | diWriteSpecial(ipbmap, 0); | 380 | diWriteSpecial(ipbmap, 0); |
382 | 381 | ||
383 | newPage = nPages; /* first new page number */ | 382 | newPage = nPages; /* first new page number */ |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 4226af3ea91b..8d31f1336431 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -502,8 +502,7 @@ out_no_rw: | |||
502 | jfs_err("jfs_umount failed with return code %d", rc); | 502 | jfs_err("jfs_umount failed with return code %d", rc); |
503 | } | 503 | } |
504 | out_mount_failed: | 504 | out_mount_failed: |
505 | filemap_fdatawrite(sbi->direct_inode->i_mapping); | 505 | filemap_write_and_wait(sbi->direct_inode->i_mapping); |
506 | filemap_fdatawait(sbi->direct_inode->i_mapping); | ||
507 | truncate_inode_pages(sbi->direct_inode->i_mapping, 0); | 506 | truncate_inode_pages(sbi->direct_inode->i_mapping, 0); |
508 | make_bad_inode(sbi->direct_inode); | 507 | make_bad_inode(sbi->direct_inode); |
509 | iput(sbi->direct_inode); | 508 | iput(sbi->direct_inode); |