summaryrefslogtreecommitdiff
path: root/fs/ext4/move_extent.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-01 16:10:45 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-01 16:10:45 -0800
commit3e66848a3249105fe4973b0550b5b6cd42240168 (patch)
tree3ff7bbcf2a476291f5536ea09b256c541c4456f3 /fs/ext4/move_extent.c
parent2cda64cf6998a1d10961f69e2ac79c69b6d37795 (diff)
parentfc77dbd34c5c99bce46d40a2491937c3bcbd10af (diff)
downloadlinux-rpi-3e66848a3249105fe4973b0550b5b6cd42240168.tar.gz
linux-rpi-3e66848a3249105fe4973b0550b5b6cd42240168.tar.bz2
linux-rpi-3e66848a3249105fe4973b0550b5b6cd42240168.zip
Merge 4.5-rc6 into staging-next
We want the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4/move_extent.c')
-rw-r--r--fs/ext4/move_extent.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index fb6f11709ae6..e032a0423e35 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -265,11 +265,12 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
ext4_lblk_t orig_blk_offset, donor_blk_offset;
unsigned long blocksize = orig_inode->i_sb->s_blocksize;
unsigned int tmp_data_size, data_size, replaced_size;
- int err2, jblocks, retries = 0;
+ int i, err2, jblocks, retries = 0;
int replaced_count = 0;
int from = data_offset_in_page << orig_inode->i_blkbits;
int blocks_per_page = PAGE_CACHE_SIZE >> orig_inode->i_blkbits;
struct super_block *sb = orig_inode->i_sb;
+ struct buffer_head *bh = NULL;
/*
* It needs twice the amount of ordinary journal buffers because
@@ -380,8 +381,16 @@ data_copy:
}
/* Perform all necessary steps similar write_begin()/write_end()
* but keeping in mind that i_size will not change */
- *err = __block_write_begin(pagep[0], from, replaced_size,
- ext4_get_block);
+ if (!page_has_buffers(pagep[0]))
+ create_empty_buffers(pagep[0], 1 << orig_inode->i_blkbits, 0);
+ bh = page_buffers(pagep[0]);
+ for (i = 0; i < data_offset_in_page; i++)
+ bh = bh->b_this_page;
+ for (i = 0; i < block_len_in_page; i++) {
+ *err = ext4_get_block(orig_inode, orig_blk_offset + i, bh, 0);
+ if (*err < 0)
+ break;
+ }
if (!*err)
*err = block_commit_write(pagep[0], from, from + replaced_size);