diff options
Diffstat (limited to 'fs/ext3/namei.c')
-rw-r--r-- | fs/ext3/namei.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 2aa7101b27cd..85d132c37ee0 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -15,13 +15,13 @@ | |||
15 | * Big-endian to little-endian byte-swapping/bitmaps by | 15 | * Big-endian to little-endian byte-swapping/bitmaps by |
16 | * David S. Miller (davem@caip.rutgers.edu), 1995 | 16 | * David S. Miller (davem@caip.rutgers.edu), 1995 |
17 | * Directory entry file type support and forward compatibility hooks | 17 | * Directory entry file type support and forward compatibility hooks |
18 | * for B-tree directories by Theodore Ts'o (tytso@mit.edu), 1998 | 18 | * for B-tree directories by Theodore Ts'o (tytso@mit.edu), 1998 |
19 | * Hash Tree Directory indexing (c) | 19 | * Hash Tree Directory indexing (c) |
20 | * Daniel Phillips, 2001 | 20 | * Daniel Phillips, 2001 |
21 | * Hash Tree Directory indexing porting | 21 | * Hash Tree Directory indexing porting |
22 | * Christopher Li, 2002 | 22 | * Christopher Li, 2002 |
23 | * Hash Tree Directory indexing cleanup | 23 | * Hash Tree Directory indexing cleanup |
24 | * Theodore Ts'o, 2002 | 24 | * Theodore Ts'o, 2002 |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
@@ -76,7 +76,7 @@ static struct buffer_head *ext3_append(handle_t *handle, | |||
76 | #ifdef DX_DEBUG | 76 | #ifdef DX_DEBUG |
77 | #define dxtrace(command) command | 77 | #define dxtrace(command) command |
78 | #else | 78 | #else |
79 | #define dxtrace(command) | 79 | #define dxtrace(command) |
80 | #endif | 80 | #endif |
81 | 81 | ||
82 | struct fake_dirent | 82 | struct fake_dirent |
@@ -169,7 +169,7 @@ static struct ext3_dir_entry_2* dx_pack_dirents (char *base, int size); | |||
169 | static void dx_insert_block (struct dx_frame *frame, u32 hash, u32 block); | 169 | static void dx_insert_block (struct dx_frame *frame, u32 hash, u32 block); |
170 | static int ext3_htree_next_block(struct inode *dir, __u32 hash, | 170 | static int ext3_htree_next_block(struct inode *dir, __u32 hash, |
171 | struct dx_frame *frame, | 171 | struct dx_frame *frame, |
172 | struct dx_frame *frames, | 172 | struct dx_frame *frames, |
173 | __u32 *start_hash); | 173 | __u32 *start_hash); |
174 | static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry, | 174 | static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry, |
175 | struct ext3_dir_entry_2 **res_dir, int *err); | 175 | struct ext3_dir_entry_2 **res_dir, int *err); |
@@ -250,7 +250,7 @@ static void dx_show_index (char * label, struct dx_entry *entries) | |||
250 | } | 250 | } |
251 | 251 | ||
252 | struct stats | 252 | struct stats |
253 | { | 253 | { |
254 | unsigned names; | 254 | unsigned names; |
255 | unsigned space; | 255 | unsigned space; |
256 | unsigned bcount; | 256 | unsigned bcount; |
@@ -278,7 +278,7 @@ static struct stats dx_show_leaf(struct dx_hash_info *hinfo, struct ext3_dir_ent | |||
278 | ((char *) de - base)); | 278 | ((char *) de - base)); |
279 | } | 279 | } |
280 | space += EXT3_DIR_REC_LEN(de->name_len); | 280 | space += EXT3_DIR_REC_LEN(de->name_len); |
281 | names++; | 281 | names++; |
282 | } | 282 | } |
283 | de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len)); | 283 | de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len)); |
284 | } | 284 | } |
@@ -464,7 +464,7 @@ static void dx_release (struct dx_frame *frames) | |||
464 | */ | 464 | */ |
465 | static int ext3_htree_next_block(struct inode *dir, __u32 hash, | 465 | static int ext3_htree_next_block(struct inode *dir, __u32 hash, |
466 | struct dx_frame *frame, | 466 | struct dx_frame *frame, |
467 | struct dx_frame *frames, | 467 | struct dx_frame *frames, |
468 | __u32 *start_hash) | 468 | __u32 *start_hash) |
469 | { | 469 | { |
470 | struct dx_frame *p; | 470 | struct dx_frame *p; |
@@ -632,7 +632,7 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash, | |||
632 | } | 632 | } |
633 | count += ret; | 633 | count += ret; |
634 | hashval = ~0; | 634 | hashval = ~0; |
635 | ret = ext3_htree_next_block(dir, HASH_NB_ALWAYS, | 635 | ret = ext3_htree_next_block(dir, HASH_NB_ALWAYS, |
636 | frame, frames, &hashval); | 636 | frame, frames, &hashval); |
637 | *next_hash = hashval; | 637 | *next_hash = hashval; |
638 | if (ret < 0) { | 638 | if (ret < 0) { |
@@ -649,7 +649,7 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash, | |||
649 | break; | 649 | break; |
650 | } | 650 | } |
651 | dx_release(frames); | 651 | dx_release(frames); |
652 | dxtrace(printk("Fill tree: returned %d entries, next hash: %x\n", | 652 | dxtrace(printk("Fill tree: returned %d entries, next hash: %x\n", |
653 | count, *next_hash)); | 653 | count, *next_hash)); |
654 | return count; | 654 | return count; |
655 | errout: | 655 | errout: |
@@ -1050,7 +1050,7 @@ struct dentry *ext3_get_parent(struct dentry *child) | |||
1050 | parent = ERR_PTR(-ENOMEM); | 1050 | parent = ERR_PTR(-ENOMEM); |
1051 | } | 1051 | } |
1052 | return parent; | 1052 | return parent; |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | #define S_SHIFT 12 | 1055 | #define S_SHIFT 12 |
1056 | static unsigned char ext3_type_by_mode[S_IFMT >> S_SHIFT] = { | 1056 | static unsigned char ext3_type_by_mode[S_IFMT >> S_SHIFT] = { |
@@ -1198,7 +1198,7 @@ errout: | |||
1198 | * add_dirent_to_buf will attempt search the directory block for | 1198 | * add_dirent_to_buf will attempt search the directory block for |
1199 | * space. It will return -ENOSPC if no space is available, and -EIO | 1199 | * space. It will return -ENOSPC if no space is available, and -EIO |
1200 | * and -EEXIST if directory entry already exists. | 1200 | * and -EEXIST if directory entry already exists. |
1201 | * | 1201 | * |
1202 | * NOTE! bh is NOT released in the case where ENOSPC is returned. In | 1202 | * NOTE! bh is NOT released in the case where ENOSPC is returned. In |
1203 | * all other cases bh is released. | 1203 | * all other cases bh is released. |
1204 | */ | 1204 | */ |
@@ -1572,7 +1572,7 @@ cleanup: | |||
1572 | * ext3_delete_entry deletes a directory entry by merging it with the | 1572 | * ext3_delete_entry deletes a directory entry by merging it with the |
1573 | * previous entry | 1573 | * previous entry |
1574 | */ | 1574 | */ |
1575 | static int ext3_delete_entry (handle_t *handle, | 1575 | static int ext3_delete_entry (handle_t *handle, |
1576 | struct inode * dir, | 1576 | struct inode * dir, |
1577 | struct ext3_dir_entry_2 * de_del, | 1577 | struct ext3_dir_entry_2 * de_del, |
1578 | struct buffer_head * bh) | 1578 | struct buffer_head * bh) |
@@ -1643,12 +1643,12 @@ static int ext3_add_nondir(handle_t *handle, | |||
1643 | * is so far negative - it has no inode. | 1643 | * is so far negative - it has no inode. |
1644 | * | 1644 | * |
1645 | * If the create succeeds, we fill in the inode information | 1645 | * If the create succeeds, we fill in the inode information |
1646 | * with d_instantiate(). | 1646 | * with d_instantiate(). |
1647 | */ | 1647 | */ |
1648 | static int ext3_create (struct inode * dir, struct dentry * dentry, int mode, | 1648 | static int ext3_create (struct inode * dir, struct dentry * dentry, int mode, |
1649 | struct nameidata *nd) | 1649 | struct nameidata *nd) |
1650 | { | 1650 | { |
1651 | handle_t *handle; | 1651 | handle_t *handle; |
1652 | struct inode * inode; | 1652 | struct inode * inode; |
1653 | int err, retries = 0; | 1653 | int err, retries = 0; |
1654 | 1654 | ||
@@ -1688,7 +1688,7 @@ static int ext3_mknod (struct inode * dir, struct dentry *dentry, | |||
1688 | 1688 | ||
1689 | retry: | 1689 | retry: |
1690 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + | 1690 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
1691 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + | 1691 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + |
1692 | 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); | 1692 | 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); |
1693 | if (IS_ERR(handle)) | 1693 | if (IS_ERR(handle)) |
1694 | return PTR_ERR(handle); | 1694 | return PTR_ERR(handle); |
@@ -1813,10 +1813,10 @@ static int empty_dir (struct inode * inode) | |||
1813 | de1 = (struct ext3_dir_entry_2 *) | 1813 | de1 = (struct ext3_dir_entry_2 *) |
1814 | ((char *) de + le16_to_cpu(de->rec_len)); | 1814 | ((char *) de + le16_to_cpu(de->rec_len)); |
1815 | if (le32_to_cpu(de->inode) != inode->i_ino || | 1815 | if (le32_to_cpu(de->inode) != inode->i_ino || |
1816 | !le32_to_cpu(de1->inode) || | 1816 | !le32_to_cpu(de1->inode) || |
1817 | strcmp (".", de->name) || | 1817 | strcmp (".", de->name) || |
1818 | strcmp ("..", de1->name)) { | 1818 | strcmp ("..", de1->name)) { |
1819 | ext3_warning (inode->i_sb, "empty_dir", | 1819 | ext3_warning (inode->i_sb, "empty_dir", |
1820 | "bad directory (dir #%lu) - no `.' or `..'", | 1820 | "bad directory (dir #%lu) - no `.' or `..'", |
1821 | inode->i_ino); | 1821 | inode->i_ino); |
1822 | brelse (bh); | 1822 | brelse (bh); |
@@ -1883,7 +1883,7 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode) | |||
1883 | * being truncated, or files being unlinked. */ | 1883 | * being truncated, or files being unlinked. */ |
1884 | 1884 | ||
1885 | /* @@@ FIXME: Observation from aviro: | 1885 | /* @@@ FIXME: Observation from aviro: |
1886 | * I think I can trigger J_ASSERT in ext3_orphan_add(). We block | 1886 | * I think I can trigger J_ASSERT in ext3_orphan_add(). We block |
1887 | * here (on lock_super()), so race with ext3_link() which might bump | 1887 | * here (on lock_super()), so race with ext3_link() which might bump |
1888 | * ->i_nlink. For, say it, character device. Not a regular file, | 1888 | * ->i_nlink. For, say it, character device. Not a regular file, |
1889 | * not a directory, not a symlink and ->i_nlink > 0. | 1889 | * not a directory, not a symlink and ->i_nlink > 0. |
@@ -1919,8 +1919,8 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode) | |||
1919 | if (!err) | 1919 | if (!err) |
1920 | list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan); | 1920 | list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan); |
1921 | 1921 | ||
1922 | jbd_debug(4, "superblock will point to %ld\n", inode->i_ino); | 1922 | jbd_debug(4, "superblock will point to %lu\n", inode->i_ino); |
1923 | jbd_debug(4, "orphan inode %ld will point to %d\n", | 1923 | jbd_debug(4, "orphan inode %lu will point to %d\n", |
1924 | inode->i_ino, NEXT_ORPHAN(inode)); | 1924 | inode->i_ino, NEXT_ORPHAN(inode)); |
1925 | out_unlock: | 1925 | out_unlock: |
1926 | unlock_super(sb); | 1926 | unlock_super(sb); |
@@ -2129,7 +2129,7 @@ static int ext3_symlink (struct inode * dir, | |||
2129 | 2129 | ||
2130 | retry: | 2130 | retry: |
2131 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + | 2131 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
2132 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 5 + | 2132 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 5 + |
2133 | 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); | 2133 | 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); |
2134 | if (IS_ERR(handle)) | 2134 | if (IS_ERR(handle)) |
2135 | return PTR_ERR(handle); | 2135 | return PTR_ERR(handle); |
@@ -2227,7 +2227,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2227 | DQUOT_INIT(new_dentry->d_inode); | 2227 | DQUOT_INIT(new_dentry->d_inode); |
2228 | handle = ext3_journal_start(old_dir, 2 * | 2228 | handle = ext3_journal_start(old_dir, 2 * |
2229 | EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) + | 2229 | EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) + |
2230 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2); | 2230 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2); |
2231 | if (IS_ERR(handle)) | 2231 | if (IS_ERR(handle)) |
2232 | return PTR_ERR(handle); | 2232 | return PTR_ERR(handle); |
2233 | 2233 | ||
@@ -2393,4 +2393,4 @@ struct inode_operations ext3_special_inode_operations = { | |||
2393 | .removexattr = generic_removexattr, | 2393 | .removexattr = generic_removexattr, |
2394 | #endif | 2394 | #endif |
2395 | .permission = ext3_permission, | 2395 | .permission = ext3_permission, |
2396 | }; | 2396 | }; |