Skip to content

Commit

Permalink
block_dev: switch to fixed_size_llseek()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jun 29, 2013
1 parent d2c40f7 commit 5d48f3a
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,31 +325,10 @@ static int blkdev_write_end(struct file *file, struct address_space *mapping,
static loff_t block_llseek(struct file *file, loff_t offset, int whence)
{
struct inode *bd_inode = file->f_mapping->host;
loff_t size;
loff_t retval;

mutex_lock(&bd_inode->i_mutex);
size = i_size_read(bd_inode);

retval = -EINVAL;
switch (whence) {
case SEEK_END:
offset += size;
break;
case SEEK_CUR:
offset += file->f_pos;
case SEEK_SET:
break;
default:
goto out;
}
if (offset >= 0 && offset <= size) {
if (offset != file->f_pos) {
file->f_pos = offset;
}
retval = offset;
}
out:
retval = fixed_size_llseek(file, offset, whence, i_size_read(bd_inode));
mutex_unlock(&bd_inode->i_mutex);
return retval;
}
Expand Down

0 comments on commit 5d48f3a

Please sign in to comment.