@@ -1326,13 +1326,11 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
* on success we return a locked page and 0
*/
static int prepare_uptodate_page(struct inode *inode,
- struct page *page, u64 pos,
- bool force_uptodate)
+ struct page *page, u64 pos)
{
int ret = 0;
- if (((pos & (PAGE_SIZE - 1)) || force_uptodate) &&
- !PageUptodate(page)) {
+ if ((pos & (PAGE_SIZE - 1)) && !PageUptodate(page)) {
ret = btrfs_readpage(NULL, page);
if (ret)
return ret;
@@ -1354,7 +1352,7 @@ static int prepare_uptodate_page(struct inode *inode,
*/
static noinline int prepare_pages(struct inode *inode, struct page **pages,
size_t num_pages, loff_t pos,
- size_t write_bytes, bool force_uptodate)
+ size_t write_bytes)
{
int i;
unsigned long index = pos >> PAGE_SHIFT;
@@ -1379,11 +1377,10 @@ static noinline int prepare_pages(struct inode *inode, struct page **pages,
}
if (i == 0)
- err = prepare_uptodate_page(inode, pages[i], pos,
- force_uptodate);
+ err = prepare_uptodate_page(inode, pages[i], pos);
if (!err && i == num_pages - 1)
err = prepare_uptodate_page(inode, pages[i],
- pos + write_bytes, false);
+ pos + write_bytes);
if (err) {
put_page(pages[i]);
if (err == -EAGAIN) {
@@ -1608,7 +1605,6 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb,
int nrptrs;
ssize_t ret;
bool only_release_metadata = false;
- bool force_page_uptodate = false;
loff_t old_isize = i_size_read(inode);
unsigned int ilock_flags = 0;
@@ -1715,8 +1711,7 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb,
* contents of pages from loop to loop
*/
ret = prepare_pages(inode, pages, num_pages,
- pos, write_bytes,
- force_page_uptodate);
+ pos, write_bytes);
if (ret) {
btrfs_delalloc_release_extents(BTRFS_I(inode),
reserve_bytes);
@@ -1743,11 +1738,9 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb,
nrptrs = 1;
if (copied == 0) {
- force_page_uptodate = true;
dirty_sectors = 0;
dirty_pages = 0;
} else {
- force_page_uptodate = false;
dirty_pages = DIV_ROUND_UP(copied + offset,
PAGE_SIZE);
}