Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 365452
b: refs/heads/master
c: 865ffef
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Monakhov authored and Linus Torvalds committed Apr 29, 2013
1 parent 5c86a57 commit 0cb7da7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 209ff86d61d6b50979cffb47878fc77ca2f6c8a2
refs/heads/master: 865ffef3797da2cac85b3354b5b6050dc9660978
29 changes: 21 additions & 8 deletions trunk/mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@ static int sleep_on_page_killable(void *word)
return fatal_signal_pending(current) ? -EINTR : 0;
}

static int filemap_check_errors(struct address_space *mapping)
{
int ret = 0;
/* Check for outstanding write errors */
if (test_and_clear_bit(AS_ENOSPC, &mapping->flags))
ret = -ENOSPC;
if (test_and_clear_bit(AS_EIO, &mapping->flags))
ret = -EIO;
return ret;
}

/**
* __filemap_fdatawrite_range - start writeback on mapping dirty pages in range
* @mapping: address space structure to write
Expand Down Expand Up @@ -269,10 +280,10 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte,
pgoff_t end = end_byte >> PAGE_CACHE_SHIFT;
struct pagevec pvec;
int nr_pages;
int ret = 0;
int ret2, ret = 0;

if (end_byte < start_byte)
return 0;
goto out;

pagevec_init(&pvec, 0);
while ((index <= end) &&
Expand All @@ -295,12 +306,10 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte,
pagevec_release(&pvec);
cond_resched();
}

/* Check for outstanding write errors */
if (test_and_clear_bit(AS_ENOSPC, &mapping->flags))
ret = -ENOSPC;
if (test_and_clear_bit(AS_EIO, &mapping->flags))
ret = -EIO;
out:
ret2 = filemap_check_errors(mapping);
if (!ret)
ret = ret2;

return ret;
}
Expand Down Expand Up @@ -341,6 +350,8 @@ int filemap_write_and_wait(struct address_space *mapping)
if (!err)
err = err2;
}
} else {
err = filemap_check_errors(mapping);
}
return err;
}
Expand Down Expand Up @@ -372,6 +383,8 @@ int filemap_write_and_wait_range(struct address_space *mapping,
if (!err)
err = err2;
}
} else {
err = filemap_check_errors(mapping);
}
return err;
}
Expand Down

0 comments on commit 0cb7da7

Please sign in to comment.