btrfs: remove unused map_private_extent_buffer
authorDavid Sterba <dsterba@suse.com>
Wed, 29 Apr 2020 21:36:03 +0000 (23:36 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 May 2020 09:25:33 +0000 (11:25 +0200)
All uses of map_private_extent_buffer have been replaced by more
effective way. The set/get helpers have their own bounds checker.
The function name was confusing since the non-private helper was removed
in a65917156e34 ("Btrfs: stop using highmem for extent_buffers") many
years ago.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h

index 22db0b2..67ee46a 100644 (file)
@@ -5685,48 +5685,6 @@ int read_extent_buffer_to_user(const struct extent_buffer *eb,
        return ret;
 }
 
-/*
- * return 0 if the item is found within a page.
- * return 1 if the item spans two pages.
- * return -EINVAL otherwise.
- */
-int map_private_extent_buffer(const struct extent_buffer *eb,
-                             unsigned long start, unsigned long min_len,
-                             char **map, unsigned long *map_start,
-                             unsigned long *map_len)
-{
-       size_t offset;
-       char *kaddr;
-       struct page *p;
-       size_t start_offset = offset_in_page(eb->start);
-       unsigned long i = (start_offset + start) >> PAGE_SHIFT;
-       unsigned long end_i = (start_offset + start + min_len - 1) >>
-               PAGE_SHIFT;
-
-       if (start + min_len > eb->len) {
-               WARN(1, KERN_ERR "btrfs bad mapping eb start %llu len %lu, wanted %lu %lu\n",
-                      eb->start, eb->len, start, min_len);
-               return -EINVAL;
-       }
-
-       if (i != end_i)
-               return 1;
-
-       if (i == 0) {
-               offset = start_offset;
-               *map_start = 0;
-       } else {
-               offset = 0;
-               *map_start = ((u64)i << PAGE_SHIFT) - start_offset;
-       }
-
-       p = eb->pages[i];
-       kaddr = page_address(p);
-       *map = kaddr + offset;
-       *map_len = PAGE_SIZE - offset;
-       return 0;
-}
-
 int memcmp_extent_buffer(const struct extent_buffer *eb, const void *ptrv,
                         unsigned long start, unsigned long len)
 {
index a2842b2..9ed89c0 100644 (file)
@@ -271,10 +271,6 @@ bool set_extent_buffer_dirty(struct extent_buffer *eb);
 void set_extent_buffer_uptodate(struct extent_buffer *eb);
 void clear_extent_buffer_uptodate(struct extent_buffer *eb);
 int extent_buffer_under_io(struct extent_buffer *eb);
-int map_private_extent_buffer(const struct extent_buffer *eb,
-                             unsigned long offset, unsigned long min_len,
-                             char **map, unsigned long *map_start,
-                             unsigned long *map_len);
 void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end);
 void extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end);
 void extent_clear_unlock_delalloc(struct inode *inode, u64 start, u64 end,