Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4837
b: refs/heads/master
c: f50f3ac
h: refs/heads/master
i:
  4835: 09e05bd
v: v3
  • Loading branch information
Anton Altaparmakov committed May 5, 2005
1 parent 5e33949 commit f861bc8
Show file tree
Hide file tree
Showing 3 changed files with 17 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: 218357ff1b1b2f1bfdce89d608dbe33dd2f9f14b
refs/heads/master: f50f3ac51983025405a71b70b033cc6bcb0d1fc1
2 changes: 2 additions & 0 deletions trunk/fs/ntfs/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ ToDo/Notes:
value afterwards. Cache the initialized_size in the same way and
protect access to the two sizes using the size_lock.
- Minor optimization to fs/ntfs/super.c::ntfs_statfs() and its helpers.
- Use i_size_read() in fs/ntfs/inode.c once and then use the cached
value afterwards when reading the size of the bitmap inode.

2.1.22 - Many bug and race fixes and error handling improvements.

Expand Down
25 changes: 14 additions & 11 deletions trunk/fs/ntfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no)

vi = iget5_locked(sb, mft_no, (test_t)ntfs_test_inode,
(set_t)ntfs_init_locked_inode, &na);
if (!vi)
if (unlikely(!vi))
return ERR_PTR(-ENOMEM);

err = 0;
Expand All @@ -188,7 +188,7 @@ struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no)
* There is no point in keeping bad inodes around if the failure was
* due to ENOMEM. We want to be able to retry again later.
*/
if (err == -ENOMEM) {
if (unlikely(err == -ENOMEM)) {
iput(vi);
vi = ERR_PTR(err);
}
Expand Down Expand Up @@ -235,7 +235,7 @@ struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPE type,

vi = iget5_locked(base_vi->i_sb, na.mft_no, (test_t)ntfs_test_inode,
(set_t)ntfs_init_locked_inode, &na);
if (!vi)
if (unlikely(!vi))
return ERR_PTR(-ENOMEM);

err = 0;
Expand All @@ -250,7 +250,7 @@ struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPE type,
* simplifies things in that we never need to check for bad attribute
* inodes elsewhere.
*/
if (err) {
if (unlikely(err)) {
iput(vi);
vi = ERR_PTR(err);
}
Expand Down Expand Up @@ -290,7 +290,7 @@ struct inode *ntfs_index_iget(struct inode *base_vi, ntfschar *name,

vi = iget5_locked(base_vi->i_sb, na.mft_no, (test_t)ntfs_test_inode,
(set_t)ntfs_init_locked_inode, &na);
if (!vi)
if (unlikely(!vi))
return ERR_PTR(-ENOMEM);

err = 0;
Expand All @@ -305,7 +305,7 @@ struct inode *ntfs_index_iget(struct inode *base_vi, ntfschar *name,
* simplifies things in that we never need to check for bad index
* inodes elsewhere.
*/
if (err) {
if (unlikely(err)) {
iput(vi);
vi = ERR_PTR(err);
}
Expand Down Expand Up @@ -742,6 +742,7 @@ static int ntfs_read_locked_inode(struct inode *vi)
* in ntfs_ino->attr_list and it is ntfs_ino->attr_list_size bytes.
*/
if (S_ISDIR(vi->i_mode)) {
loff_t bvi_size;
struct inode *bvi;
ntfs_inode *bni;
INDEX_ROOT *ir;
Expand Down Expand Up @@ -959,11 +960,12 @@ static int ntfs_read_locked_inode(struct inode *vi)
goto unm_err_out;
}
/* Consistency check bitmap size vs. index allocation size. */
if ((bvi->i_size << 3) < (vi->i_size >>
bvi_size = i_size_read(bvi);
if ((bvi_size << 3) < (vi->i_size >>
ni->itype.index.block_size_bits)) {
ntfs_error(vi->i_sb, "Index bitmap too small (0x%llx) "
"for index allocation (0x%llx).",
bvi->i_size << 3, vi->i_size);
bvi_size << 3, vi->i_size);
goto unm_err_out;
}
skip_large_dir_stuff:
Expand Down Expand Up @@ -1430,6 +1432,7 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
*/
static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
{
loff_t bvi_size;
ntfs_volume *vol = NTFS_SB(vi->i_sb);
ntfs_inode *ni, *base_ni, *bni;
struct inode *bvi;
Expand Down Expand Up @@ -1633,10 +1636,10 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
goto iput_unm_err_out;
}
/* Consistency check bitmap size vs. index allocation size. */
if ((bvi->i_size << 3) < (vi->i_size >>
ni->itype.index.block_size_bits)) {
bvi_size = i_size_read(bvi);
if ((bvi_size << 3) < (vi->i_size >> ni->itype.index.block_size_bits)) {
ntfs_error(vi->i_sb, "Index bitmap too small (0x%llx) for "
"index allocation (0x%llx).", bvi->i_size << 3,
"index allocation (0x%llx).", bvi_size << 3,
vi->i_size);
goto iput_unm_err_out;
}
Expand Down

0 comments on commit f861bc8

Please sign in to comment.