diff options
author | Andrew Morton <akpm@osdl.org> | 2004-08-22 22:38:12 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-22 22:38:12 -0700 |
commit | a88cff7fcf8532decbbec25aaf0ba57e97d98227 (patch) | |
tree | d16f52b4836a184606b50dd720396adf60ed47e7 /fs | |
parent | 681bf63d288eb4465d0d9ead0829a6cbf52f0666 (diff) | |
download | history-a88cff7fcf8532decbbec25aaf0ba57e97d98227.tar.gz |
[PATCH] make sync_dirty_buffer() return something useful
Make sync_dirty_buffer() return the result of its syncing.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/buffer.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 277147586fdae9..e2fdba6182a673 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2868,20 +2868,26 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[]) /* * For a data-integrity writeout, we need to wait upon any in-progress I/O - * and then start new I/O and then wait upon it. + * and then start new I/O and then wait upon it. The caller must have a ref on + * the buffer_head. */ -void sync_dirty_buffer(struct buffer_head *bh) +int sync_dirty_buffer(struct buffer_head *bh) { + int ret = 0; + WARN_ON(atomic_read(&bh->b_count) < 1); lock_buffer(bh); if (test_clear_buffer_dirty(bh)) { get_bh(bh); bh->b_end_io = end_buffer_write_sync; - submit_bh(WRITE, bh); + ret = submit_bh(WRITE, bh); wait_on_buffer(bh); + if (!ret && !buffer_uptodate(bh)) + ret = -EIO; } else { unlock_buffer(bh); } + return ret; } /* |