diff options
author | Nick Piggin <npiggin@suse.de> | 2007-03-27 02:55:39 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-03-27 02:55:39 -0400 |
commit | 08c72591636829d40bd695d43ec6d2a8191b668b (patch) | |
tree | ded334291dfd9b3e72727fd4d71c8036bfd911f9 | |
parent | 485ddb4b9741bafb70b22e5c1f9b4f37dc3e85bd (diff) |
2/2 splice: dont readpage
Splice does not need to readpage to bring the page uptodate before writing
to it, because prepare_write will take care of that for us.
Splice is also wrong to SetPageUptodate before the page is actually uptodate.
This results in the old uninitialised memory leak. This gets fixed as a
matter of course when removing the readpage logic.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | fs/splice.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/fs/splice.c b/fs/splice.c index badc78ff1246..ae50208e3e6c 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -593,36 +593,6 @@ find_page: | |||
593 | goto out; | 593 | goto out; |
594 | } | 594 | } |
595 | 595 | ||
596 | /* | ||
597 | * We get here with the page locked. If the page is also | ||
598 | * uptodate, we don't need to do more. If it isn't, we | ||
599 | * may need to bring it in if we are not going to overwrite | ||
600 | * the full page. | ||
601 | */ | ||
602 | if (!PageUptodate(page)) { | ||
603 | if (this_len < PAGE_CACHE_SIZE) { | ||
604 | ret = mapping->a_ops->readpage(file, page); | ||
605 | if (unlikely(ret)) | ||
606 | goto out; | ||
607 | |||
608 | lock_page(page); | ||
609 | |||
610 | if (!PageUptodate(page)) { | ||
611 | /* | ||
612 | * Page got invalidated, repeat. | ||
613 | */ | ||
614 | if (!page->mapping) { | ||
615 | unlock_page(page); | ||
616 | page_cache_release(page); | ||
617 | goto find_page; | ||
618 | } | ||
619 | ret = -EIO; | ||
620 | goto out; | ||
621 | } | ||
622 | } else | ||
623 | SetPageUptodate(page); | ||
624 | } | ||
625 | |||
626 | ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len); | 596 | ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len); |
627 | if (unlikely(ret)) { | 597 | if (unlikely(ret)) { |
628 | loff_t isize = i_size_read(mapping->host); | 598 | loff_t isize = i_size_read(mapping->host); |