diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-11 22:29:51 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-11 22:29:51 -0400 |
commit | dfea934575164497a9e36074ebce606a1a278ed9 (patch) | |
tree | b39ec564ae5a84956af80ae43de24c4f91720519 /fs/ocfs2/file.c | |
parent | 165f1a6e300d5a1ffb57cf9a9c8762de731228f2 (diff) | |
parent | 64b4e2526d1cf6e6a4db6213d6e2b6e6ab59479a (diff) |
Merge branch 'for-linus' into for-next
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 1c11314946cb..8096fb6c081b 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2391,7 +2391,6 @@ relock: | |||
2391 | /* | 2391 | /* |
2392 | * for completing the rest of the request. | 2392 | * for completing the rest of the request. |
2393 | */ | 2393 | */ |
2394 | *ppos += written; | ||
2395 | count -= written; | 2394 | count -= written; |
2396 | written_buffered = generic_perform_write(file, from, *ppos); | 2395 | written_buffered = generic_perform_write(file, from, *ppos); |
2397 | /* | 2396 | /* |
@@ -2406,7 +2405,6 @@ relock: | |||
2406 | goto out_dio; | 2405 | goto out_dio; |
2407 | } | 2406 | } |
2408 | 2407 | ||
2409 | iocb->ki_pos = *ppos + written_buffered; | ||
2410 | /* We need to ensure that the page cache pages are written to | 2408 | /* We need to ensure that the page cache pages are written to |
2411 | * disk and invalidated to preserve the expected O_DIRECT | 2409 | * disk and invalidated to preserve the expected O_DIRECT |
2412 | * semantics. | 2410 | * semantics. |
@@ -2415,6 +2413,7 @@ relock: | |||
2415 | ret = filemap_write_and_wait_range(file->f_mapping, *ppos, | 2413 | ret = filemap_write_and_wait_range(file->f_mapping, *ppos, |
2416 | endbyte); | 2414 | endbyte); |
2417 | if (ret == 0) { | 2415 | if (ret == 0) { |
2416 | iocb->ki_pos = *ppos + written_buffered; | ||
2418 | written += written_buffered; | 2417 | written += written_buffered; |
2419 | invalidate_mapping_pages(mapping, | 2418 | invalidate_mapping_pages(mapping, |
2420 | *ppos >> PAGE_CACHE_SHIFT, | 2419 | *ppos >> PAGE_CACHE_SHIFT, |
@@ -2437,10 +2436,14 @@ out_dio: | |||
2437 | /* buffered aio wouldn't have proper lock coverage today */ | 2436 | /* buffered aio wouldn't have proper lock coverage today */ |
2438 | BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); | 2437 | BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); |
2439 | 2438 | ||
2439 | if (unlikely(written <= 0)) | ||
2440 | goto no_sync; | ||
2441 | |||
2440 | if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || | 2442 | if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || |
2441 | ((file->f_flags & O_DIRECT) && !direct_io)) { | 2443 | ((file->f_flags & O_DIRECT) && !direct_io)) { |
2442 | ret = filemap_fdatawrite_range(file->f_mapping, *ppos, | 2444 | ret = filemap_fdatawrite_range(file->f_mapping, |
2443 | *ppos + count - 1); | 2445 | iocb->ki_pos - written, |
2446 | iocb->ki_pos - 1); | ||
2444 | if (ret < 0) | 2447 | if (ret < 0) |
2445 | written = ret; | 2448 | written = ret; |
2446 | 2449 | ||
@@ -2451,10 +2454,12 @@ out_dio: | |||
2451 | } | 2454 | } |
2452 | 2455 | ||
2453 | if (!ret) | 2456 | if (!ret) |
2454 | ret = filemap_fdatawait_range(file->f_mapping, *ppos, | 2457 | ret = filemap_fdatawait_range(file->f_mapping, |
2455 | *ppos + count - 1); | 2458 | iocb->ki_pos - written, |
2459 | iocb->ki_pos - 1); | ||
2456 | } | 2460 | } |
2457 | 2461 | ||
2462 | no_sync: | ||
2458 | /* | 2463 | /* |
2459 | * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io | 2464 | * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io |
2460 | * function pointer which is called when o_direct io completes so that | 2465 | * function pointer which is called when o_direct io completes so that |