aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index a8ee75cb96ee..9c6673a9231f 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2120,7 +2120,7 @@ out:
2120 return ret; 2120 return ret;
2121} 2121}
2122 2122
2123static int find_desired_extent(struct inode *inode, loff_t *offset, int origin) 2123static int find_desired_extent(struct inode *inode, loff_t *offset, int whence)
2124{ 2124{
2125 struct btrfs_root *root = BTRFS_I(inode)->root; 2125 struct btrfs_root *root = BTRFS_I(inode)->root;
2126 struct extent_map *em; 2126 struct extent_map *em;
@@ -2154,7 +2154,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
2154 * before the position we want in case there is outstanding delalloc 2154 * before the position we want in case there is outstanding delalloc
2155 * going on here. 2155 * going on here.
2156 */ 2156 */
2157 if (origin == SEEK_HOLE && start != 0) { 2157 if (whence == SEEK_HOLE && start != 0) {
2158 if (start <= root->sectorsize) 2158 if (start <= root->sectorsize)
2159 em = btrfs_get_extent_fiemap(inode, NULL, 0, 0, 2159 em = btrfs_get_extent_fiemap(inode, NULL, 0, 0,
2160 root->sectorsize, 0); 2160 root->sectorsize, 0);
@@ -2188,13 +2188,13 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
2188 } 2188 }
2189 } 2189 }
2190 2190
2191 if (origin == SEEK_HOLE) { 2191 if (whence == SEEK_HOLE) {
2192 *offset = start; 2192 *offset = start;
2193 free_extent_map(em); 2193 free_extent_map(em);
2194 break; 2194 break;
2195 } 2195 }
2196 } else { 2196 } else {
2197 if (origin == SEEK_DATA) { 2197 if (whence == SEEK_DATA) {
2198 if (em->block_start == EXTENT_MAP_DELALLOC) { 2198 if (em->block_start == EXTENT_MAP_DELALLOC) {
2199 if (start >= inode->i_size) { 2199 if (start >= inode->i_size) {
2200 free_extent_map(em); 2200 free_extent_map(em);
@@ -2231,16 +2231,16 @@ out:
2231 return ret; 2231 return ret;
2232} 2232}
2233 2233
2234static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin) 2234static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence)
2235{ 2235{
2236 struct inode *inode = file->f_mapping->host; 2236 struct inode *inode = file->f_mapping->host;
2237 int ret; 2237 int ret;
2238 2238
2239 mutex_lock(&inode->i_mutex); 2239 mutex_lock(&inode->i_mutex);
2240 switch (origin) { 2240 switch (whence) {
2241 case SEEK_END: 2241 case SEEK_END:
2242 case SEEK_CUR: 2242 case SEEK_CUR:
2243 offset = generic_file_llseek(file, offset, origin); 2243 offset = generic_file_llseek(file, offset, whence);
2244 goto out; 2244 goto out;
2245 case SEEK_DATA: 2245 case SEEK_DATA:
2246 case SEEK_HOLE: 2246 case SEEK_HOLE:
@@ -2249,7 +2249,7 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin)
2249 return -ENXIO; 2249 return -ENXIO;
2250 } 2250 }
2251 2251
2252 ret = find_desired_extent(inode, &offset, origin); 2252 ret = find_desired_extent(inode, &offset, whence);
2253 if (ret) { 2253 if (ret) {
2254 mutex_unlock(&inode->i_mutex); 2254 mutex_unlock(&inode->i_mutex);
2255 return ret; 2255 return ret;