Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312977
b: refs/heads/master
c: e8b96eb
h: refs/heads/master
i:
  312975: d7543bf
v: v3
  • Loading branch information
Eric Sandeen authored and Al Viro committed Jul 22, 2012
1 parent 91bbc5d commit c552fb4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 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: 4ea425b63a3dfeb7707fc7cc7161c11a51e871ed
refs/heads/master: e8b96eb5034a0ccebf36760f88e31ea3e3cdf1e4
3 changes: 2 additions & 1 deletion trunk/fs/ext3/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ loff_t ext3_dir_llseek(struct file *file, loff_t offset, int origin)

if (likely(dx_dir))
return generic_file_llseek_size(file, offset, origin,
ext3_get_htree_eof(file));
ext3_get_htree_eof(file),
i_size_read(inode));
else
return generic_file_llseek(file, offset, origin);
}
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/ext4/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ loff_t ext4_llseek(struct file *file, loff_t offset, int origin)
else
maxbytes = inode->i_sb->s_maxbytes;

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

const struct file_operations ext4_file_operations = {
Expand Down
18 changes: 10 additions & 8 deletions trunk/fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ static loff_t lseek_execute(struct file *file, struct inode *inode,
* @file: file structure to seek on
* @offset: file offset to seek to
* @origin: type of seek
* @size: max size of file system
* @size: max size of this file in file system
* @eof: offset used for SEEK_END position
*
* This is a variant of generic_file_llseek that allows passing in a custom
* file size.
* maximum file size and a custom EOF position, for e.g. hashed directories
*
* Synchronization:
* SEEK_SET and SEEK_END are unsynchronized (but atomic on 64bit platforms)
Expand All @@ -67,13 +68,13 @@ static loff_t lseek_execute(struct file *file, struct inode *inode,
*/
loff_t
generic_file_llseek_size(struct file *file, loff_t offset, int origin,
loff_t maxsize)
loff_t maxsize, loff_t eof)
{
struct inode *inode = file->f_mapping->host;

switch (origin) {
case SEEK_END:
offset += i_size_read(inode);
offset += eof;
break;
case SEEK_CUR:
/*
Expand All @@ -99,17 +100,17 @@ generic_file_llseek_size(struct file *file, loff_t offset, int origin,
* 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 >= i_size_read(inode))
if (offset >= eof)
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 >= i_size_read(inode))
if (offset >= eof)
return -ENXIO;
offset = i_size_read(inode);
offset = eof;
break;
}

Expand All @@ -132,7 +133,8 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int origin)
struct inode *inode = file->f_mapping->host;

return generic_file_llseek_size(file, offset, origin,
inode->i_sb->s_maxbytes);
inode->i_sb->s_maxbytes,
i_size_read(inode));
}
EXPORT_SYMBOL(generic_file_llseek);

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2454,7 +2454,7 @@ extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,
int origin, loff_t maxsize);
int origin, loff_t maxsize, loff_t eof);
extern int generic_file_open(struct inode * inode, struct file * filp);
extern int nonseekable_open(struct inode * inode, struct file * filp);

Expand Down

0 comments on commit c552fb4

Please sign in to comment.