Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 31039
b: refs/heads/master
c: 81b0c87
h: refs/heads/master
i:
  31037: 31c246b
  31035: 8d79380
  31031: 706f8f4
  31023: ef92152
  31007: 9b365ca
  30975: abd44fd
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Jun 29, 2006
1 parent 82478c4 commit bf03e5b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 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: 0686cd8fbe3e5fb1441ae84b9cbc813f9297b879
refs/heads/master: 81b0c8713385ce1b1b9058e916edcf9561ad76d6
9 changes: 8 additions & 1 deletion trunk/mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,12 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
break;
}

if (unlikely(bytes == 0)) {
status = 0;
copied = 0;
goto zero_length_segment;
}

status = a_ops->prepare_write(file, page, offset, offset+bytes);
if (unlikely(status)) {
loff_t isize = i_size_read(inode);
Expand Down Expand Up @@ -2154,7 +2160,8 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
page_cache_release(page);
continue;
}
if (likely(copied > 0)) {
zero_length_segment:
if (likely(copied >= 0)) {
if (!status)
status = copied;

Expand Down
4 changes: 2 additions & 2 deletions trunk/mm/filemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes)
const struct iovec *iov = *iovp;
size_t base = *basep;

while (bytes) {
do {
int copy = min(bytes, iov->iov_len - base);

bytes -= copy;
Expand All @@ -97,7 +97,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes)
iov++;
base = 0;
}
}
} while (bytes);
*iovp = iov;
*basep = base;
}
Expand Down

0 comments on commit bf03e5b

Please sign in to comment.