Commit 7e6e9012 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] block_llseek(): remove lock_kernel()

Replace it with the blockdev inode's i_sem.  And we only really need that for
atomic access to file->f_pos.
parent e90f7e03
...@@ -155,11 +155,13 @@ static int blkdev_commit_write(struct file *file, struct page *page, unsigned fr ...@@ -155,11 +155,13 @@ static int blkdev_commit_write(struct file *file, struct page *page, unsigned fr
*/ */
static loff_t block_llseek(struct file *file, loff_t offset, int origin) static loff_t block_llseek(struct file *file, loff_t offset, int origin)
{ {
/* ewww */ struct inode *bd_inode;
loff_t size = file->f_dentry->d_inode->i_bdev->bd_inode->i_size; loff_t size;
loff_t retval; loff_t retval;
lock_kernel(); bd_inode = file->f_dentry->d_inode->i_bdev->bd_inode;
down(&bd_inode->i_sem);
size = bd_inode->i_size;
switch (origin) { switch (origin) {
case 2: case 2:
...@@ -175,7 +177,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin) ...@@ -175,7 +177,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin)
} }
retval = offset; retval = offset;
} }
unlock_kernel(); up(&bd_inode->i_sem);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment