Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 377635
b: refs/heads/master
c: e1be3a9
h: refs/heads/master
i:
  377633: f481d79
  377631: f8981d7
v: v3
  • Loading branch information
Lukas Czerner authored and Theodore Ts'o committed Jul 1, 2013
1 parent 4f28128 commit e7ecdad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 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: 42c832debbbf819f6c4ad8601baa559c44105ba4
refs/heads/master: e1be3a928ee0b0b2a893695e6dd5c5dbe293af16
17 changes: 10 additions & 7 deletions trunk/fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3424,33 +3424,36 @@ int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
{
struct super_block *sb = inode->i_sb;
struct address_space *mapping = inode->i_mapping;
unsigned partial = lstart & (sb->s_blocksize - 1);
unsigned partial_start, partial_end;
ext4_fsblk_t start, end;
loff_t byte_end = (lstart + length - 1);
int err = 0;

partial_start = lstart & (sb->s_blocksize - 1);
partial_end = byte_end & (sb->s_blocksize - 1);

start = lstart >> sb->s_blocksize_bits;
end = byte_end >> sb->s_blocksize_bits;

/* Handle partial zero within the single block */
if (start == end) {
if (start == end &&
(partial_start || (partial_end != sb->s_blocksize - 1))) {
err = ext4_block_zero_page_range(handle, mapping,
lstart, length);
return err;
}
/* Handle partial zero out on the start of the range */
if (partial) {
if (partial_start) {
err = ext4_block_zero_page_range(handle, mapping,
lstart, sb->s_blocksize);
if (err)
return err;
}
/* Handle partial zero out on the end of the range */
partial = byte_end & (sb->s_blocksize - 1);
if (partial != sb->s_blocksize - 1)
if (partial_end != sb->s_blocksize - 1)
err = ext4_block_zero_page_range(handle, mapping,
byte_end - partial,
partial + 1);
byte_end - partial_end,
partial_end + 1);
return err;
}

Expand Down

0 comments on commit e7ecdad

Please sign in to comment.