diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-29 15:31:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-29 20:48:12 -0500 |
commit | bbec0270bdd887f96377065ee38b8848b5afa395 (patch) | |
tree | 4a38397643dceb5285afe11c78e27763a2ead5b8 /fs/buffer.c | |
parent | ab73857e354ab9e317613cba7db714e2c12c6547 (diff) |
blkdev_max_block: make private to fs/buffer.c
We really don't want to look at the block size for the raw block device
accesses in fs/block-dev.c, because it may be changing from under us.
So get rid of the max_block logic entirely, since the caller should
already have done it anyway.
That leaves the only user of this function in fs/buffer.c, so move the
whole function there and make it static.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 28a74ff5324b..3586fb05c8ce 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -911,6 +911,18 @@ link_dev_buffers(struct page *page, struct buffer_head *head) | |||
911 | attach_page_buffers(page, head); | 911 | attach_page_buffers(page, head); |
912 | } | 912 | } |
913 | 913 | ||
914 | static sector_t blkdev_max_block(struct block_device *bdev, unsigned int size) | ||
915 | { | ||
916 | sector_t retval = ~((sector_t)0); | ||
917 | loff_t sz = i_size_read(bdev->bd_inode); | ||
918 | |||
919 | if (sz) { | ||
920 | unsigned int sizebits = blksize_bits(size); | ||
921 | retval = (sz >> sizebits); | ||
922 | } | ||
923 | return retval; | ||
924 | } | ||
925 | |||
914 | /* | 926 | /* |
915 | * Initialise the state of a blockdev page's buffers. | 927 | * Initialise the state of a blockdev page's buffers. |
916 | */ | 928 | */ |
@@ -921,7 +933,7 @@ init_page_buffers(struct page *page, struct block_device *bdev, | |||
921 | struct buffer_head *head = page_buffers(page); | 933 | struct buffer_head *head = page_buffers(page); |
922 | struct buffer_head *bh = head; | 934 | struct buffer_head *bh = head; |
923 | int uptodate = PageUptodate(page); | 935 | int uptodate = PageUptodate(page); |
924 | sector_t end_block = blkdev_max_block(I_BDEV(bdev->bd_inode)); | 936 | sector_t end_block = blkdev_max_block(I_BDEV(bdev->bd_inode), size); |
925 | 937 | ||
926 | do { | 938 | do { |
927 | if (!buffer_mapped(bh)) { | 939 | if (!buffer_mapped(bh)) { |