mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
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>
This commit is contained in:
parent
ab73857e35
commit
bbec0270bd
3 changed files with 14 additions and 56 deletions
14
fs/buffer.c
14
fs/buffer.c
|
@ -911,6 +911,18 @@ link_dev_buffers(struct page *page, struct buffer_head *head)
|
|||
attach_page_buffers(page, head);
|
||||
}
|
||||
|
||||
static sector_t blkdev_max_block(struct block_device *bdev, unsigned int size)
|
||||
{
|
||||
sector_t retval = ~((sector_t)0);
|
||||
loff_t sz = i_size_read(bdev->bd_inode);
|
||||
|
||||
if (sz) {
|
||||
unsigned int sizebits = blksize_bits(size);
|
||||
retval = (sz >> sizebits);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise the state of a blockdev page's buffers.
|
||||
*/
|
||||
|
@ -921,7 +933,7 @@ init_page_buffers(struct page *page, struct block_device *bdev,
|
|||
struct buffer_head *head = page_buffers(page);
|
||||
struct buffer_head *bh = head;
|
||||
int uptodate = PageUptodate(page);
|
||||
sector_t end_block = blkdev_max_block(I_BDEV(bdev->bd_inode));
|
||||
sector_t end_block = blkdev_max_block(I_BDEV(bdev->bd_inode), size);
|
||||
|
||||
do {
|
||||
if (!buffer_mapped(bh)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue