aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorZach Brown <zab@redhat.com>2013-10-16 15:10:33 -0400
committerChris Mason <chris.mason@fusionio.com>2013-11-11 22:03:09 -0500
commit1877e1a747db33d7264d8046e96373962da72a3d (patch)
treeb928d5a17bacd6644631d200e3a82232202b2aec /fs/btrfs
parent4546bcaeba435c1d0b7f38c011cbb2367497ca8d (diff)
btrfs: remove move_pages()
move_pages() has an inefficient backwards byte copy of regions of two different pages. They're different pages so the regions won't overlap and it could use memcpy(). At that point, though, move_pages() would be a slightly dimmer re-implementation of copy_pages() that lacked the test for overlapping page regions. So remove move_pages() and just call copy_pages(). Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/extent_io.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 5439f24ab06b..5bf98d2ee70f 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -5082,23 +5082,6 @@ void copy_extent_buffer(struct extent_buffer *dst, struct extent_buffer *src,
5082 } 5082 }
5083} 5083}
5084 5084
5085static void move_pages(struct page *dst_page, struct page *src_page,
5086 unsigned long dst_off, unsigned long src_off,
5087 unsigned long len)
5088{
5089 char *dst_kaddr = page_address(dst_page);
5090 if (dst_page == src_page) {
5091 memmove(dst_kaddr + dst_off, dst_kaddr + src_off, len);
5092 } else {
5093 char *src_kaddr = page_address(src_page);
5094 char *p = dst_kaddr + dst_off + len;
5095 char *s = src_kaddr + src_off + len;
5096
5097 while (len--)
5098 *--p = *--s;
5099 }
5100}
5101
5102static inline bool areas_overlap(unsigned long src, unsigned long dst, unsigned long len) 5085static inline bool areas_overlap(unsigned long src, unsigned long dst, unsigned long len)
5103{ 5086{
5104 unsigned long distance = (src > dst) ? src - dst : dst - src; 5087 unsigned long distance = (src > dst) ? src - dst : dst - src;
@@ -5209,7 +5192,7 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
5209 5192
5210 cur = min_t(unsigned long, len, src_off_in_page + 1); 5193 cur = min_t(unsigned long, len, src_off_in_page + 1);
5211 cur = min(cur, dst_off_in_page + 1); 5194 cur = min(cur, dst_off_in_page + 1);
5212 move_pages(extent_buffer_page(dst, dst_i), 5195 copy_pages(extent_buffer_page(dst, dst_i),
5213 extent_buffer_page(dst, src_i), 5196 extent_buffer_page(dst, src_i),
5214 dst_off_in_page - cur + 1, 5197 dst_off_in_page - cur + 1,
5215 src_off_in_page - cur + 1, cur); 5198 src_off_in_page - cur + 1, cur);