Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 270032
b: refs/heads/master
c: 4cce0e2
h: refs/heads/master
v: v3
  • Loading branch information
Andi Kleen authored and root committed Oct 28, 2011
1 parent 7e5d349 commit 1d03f19
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5760495a872d63a182962680a13c2af29235237c
refs/heads/master: 4cce0e28b932c11454f75d1c1fae674600c23fbf
47 changes: 1 addition & 46 deletions trunk/fs/ext4/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,53 +224,8 @@ loff_t ext4_llseek(struct file *file, loff_t offset, int origin)
maxbytes = EXT4_SB(inode->i_sb)->s_bitmap_maxbytes;
else
maxbytes = inode->i_sb->s_maxbytes;
mutex_lock(&inode->i_mutex);
switch (origin) {
case SEEK_END:
offset += inode->i_size;
break;
case SEEK_CUR:
if (offset == 0) {
mutex_unlock(&inode->i_mutex);
return file->f_pos;
}
offset += file->f_pos;
break;
case SEEK_DATA:
/*
* In the generic case the entire file is data, so as long as
* offset isn't at the end of the file then the offset is data.
*/
if (offset >= inode->i_size) {
mutex_unlock(&inode->i_mutex);
return -ENXIO;
}
break;
case SEEK_HOLE:
/*
* There is a virtual hole at the end of the file, so as long as
* offset isn't i_size or larger, return i_size.
*/
if (offset >= inode->i_size) {
mutex_unlock(&inode->i_mutex);
return -ENXIO;
}
offset = inode->i_size;
break;
}

if (offset < 0 || offset > maxbytes) {
mutex_unlock(&inode->i_mutex);
return -EINVAL;
}

if (offset != file->f_pos) {
file->f_pos = offset;
file->f_version = 0;
}
mutex_unlock(&inode->i_mutex);

return offset;
return generic_file_llseek_size(file, offset, origin, maxbytes);
}

const struct file_operations ext4_file_operations = {
Expand Down

0 comments on commit 1d03f19

Please sign in to comment.