diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2004-11-18 10:01:06 -0500 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-05-05 05:32:43 -0400 |
commit | 206f9f35b2348b7b966ff18a5564b8a3ca325ed5 (patch) | |
tree | 2f221334cf8b1b9756a58e323b5fba2cdd4dc583 /fs/ntfs/dir.c | |
parent | 367636772f094fd840d2d79e75257bcfaa28e70f (diff) |
NTFS: In fs/ntfs/dir.c, use i_size_read() once and then the cached value
afterwards.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs/dir.c')
-rw-r--r-- | fs/ntfs/dir.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index 93577561cdbe..d261ac4596f5 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c | |||
@@ -1101,7 +1101,7 @@ static inline int ntfs_filldir(ntfs_volume *vol, loff_t fpos, | |||
1101 | static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 1101 | static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir) |
1102 | { | 1102 | { |
1103 | s64 ia_pos, ia_start, prev_ia_pos, bmp_pos; | 1103 | s64 ia_pos, ia_start, prev_ia_pos, bmp_pos; |
1104 | loff_t fpos; | 1104 | loff_t fpos, i_size; |
1105 | struct inode *bmp_vi, *vdir = filp->f_dentry->d_inode; | 1105 | struct inode *bmp_vi, *vdir = filp->f_dentry->d_inode; |
1106 | struct super_block *sb = vdir->i_sb; | 1106 | struct super_block *sb = vdir->i_sb; |
1107 | ntfs_inode *ndir = NTFS_I(vdir); | 1107 | ntfs_inode *ndir = NTFS_I(vdir); |
@@ -1122,7 +1122,8 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
1122 | vdir->i_ino, fpos); | 1122 | vdir->i_ino, fpos); |
1123 | rc = err = 0; | 1123 | rc = err = 0; |
1124 | /* Are we at end of dir yet? */ | 1124 | /* Are we at end of dir yet? */ |
1125 | if (fpos >= vdir->i_size + vol->mft_record_size) | 1125 | i_size = i_size_read(vdir); |
1126 | if (fpos >= i_size + vol->mft_record_size) | ||
1126 | goto done; | 1127 | goto done; |
1127 | /* Emulate . and .. for all directories. */ | 1128 | /* Emulate . and .. for all directories. */ |
1128 | if (!fpos) { | 1129 | if (!fpos) { |
@@ -1264,7 +1265,7 @@ skip_index_root: | |||
1264 | bmp_mapping = bmp_vi->i_mapping; | 1265 | bmp_mapping = bmp_vi->i_mapping; |
1265 | /* Get the starting bitmap bit position and sanity check it. */ | 1266 | /* Get the starting bitmap bit position and sanity check it. */ |
1266 | bmp_pos = ia_pos >> ndir->itype.index.block_size_bits; | 1267 | bmp_pos = ia_pos >> ndir->itype.index.block_size_bits; |
1267 | if (unlikely(bmp_pos >> 3 >= bmp_vi->i_size)) { | 1268 | if (unlikely(bmp_pos >> 3 >= i_size_read(bmp_vi))) { |
1268 | ntfs_error(sb, "Current index allocation position exceeds " | 1269 | ntfs_error(sb, "Current index allocation position exceeds " |
1269 | "index bitmap size."); | 1270 | "index bitmap size."); |
1270 | goto err_out; | 1271 | goto err_out; |
@@ -1301,7 +1302,7 @@ find_next_index_buffer: | |||
1301 | goto get_next_bmp_page; | 1302 | goto get_next_bmp_page; |
1302 | } | 1303 | } |
1303 | /* If we have reached the end of the bitmap, we are done. */ | 1304 | /* If we have reached the end of the bitmap, we are done. */ |
1304 | if (unlikely(((bmp_pos + cur_bmp_pos) >> 3) >= vdir->i_size)) | 1305 | if (unlikely(((bmp_pos + cur_bmp_pos) >> 3) >= i_size)) |
1305 | goto unm_EOD; | 1306 | goto unm_EOD; |
1306 | ia_pos = (bmp_pos + cur_bmp_pos) << | 1307 | ia_pos = (bmp_pos + cur_bmp_pos) << |
1307 | ndir->itype.index.block_size_bits; | 1308 | ndir->itype.index.block_size_bits; |
@@ -1441,7 +1442,7 @@ unm_EOD: | |||
1441 | ntfs_unmap_page(bmp_page); | 1442 | ntfs_unmap_page(bmp_page); |
1442 | EOD: | 1443 | EOD: |
1443 | /* We are finished, set fpos to EOD. */ | 1444 | /* We are finished, set fpos to EOD. */ |
1444 | fpos = vdir->i_size + vol->mft_record_size; | 1445 | fpos = i_size + vol->mft_record_size; |
1445 | abort: | 1446 | abort: |
1446 | kfree(name); | 1447 | kfree(name); |
1447 | done: | 1448 | done: |
@@ -1495,7 +1496,7 @@ err_out: | |||
1495 | static int ntfs_dir_open(struct inode *vi, struct file *filp) | 1496 | static int ntfs_dir_open(struct inode *vi, struct file *filp) |
1496 | { | 1497 | { |
1497 | if (sizeof(unsigned long) < 8) { | 1498 | if (sizeof(unsigned long) < 8) { |
1498 | if (vi->i_size > MAX_LFS_FILESIZE) | 1499 | if (i_size_read(vi) > MAX_LFS_FILESIZE) |
1499 | return -EFBIG; | 1500 | return -EFBIG; |
1500 | } | 1501 | } |
1501 | return 0; | 1502 | return 0; |