aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dir.c
diff options
context:
space:
mode:
authorJoel Becker <jlbec@evilplan.org>2011-03-28 12:44:26 -0400
committerJoel Becker <jlbec@evilplan.org>2011-03-28 12:44:26 -0400
commit99bdc3880c611c7f2061fbd5372ef81b40217e26 (patch)
treeef68a53e28e9ee53ce9db3642bab5fa5b3d44866 /fs/ocfs2/dir.c
parented59992e8d91b70053c53d846a76f7e1ac000454 (diff)
parentb4e1b7e88b2c87c358c2a88bec0c76d25accc604 (diff)
Merge branch 'mlog_replace_for_39' of git://repo.or.cz/taoma-kernel into ocfs2-merge-window-fix
Diffstat (limited to 'fs/ocfs2/dir.c')
-rw-r--r--fs/ocfs2/dir.c109
1 files changed, 45 insertions, 64 deletions
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 41b356fefaa5..b0c17490bbbc 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -43,7 +43,6 @@
43#include <linux/quotaops.h> 43#include <linux/quotaops.h>
44#include <linux/sort.h> 44#include <linux/sort.h>
45 45
46#define MLOG_MASK_PREFIX ML_NAMEI
47#include <cluster/masklog.h> 46#include <cluster/masklog.h>
48 47
49#include "ocfs2.h" 48#include "ocfs2.h"
@@ -61,6 +60,7 @@
61#include "super.h" 60#include "super.h"
62#include "sysfile.h" 61#include "sysfile.h"
63#include "uptodate.h" 62#include "uptodate.h"
63#include "ocfs2_trace.h"
64 64
65#include "buffer_head_io.h" 65#include "buffer_head_io.h"
66 66
@@ -369,8 +369,6 @@ static int inline ocfs2_search_dirblock(struct buffer_head *bh,
369 int de_len; 369 int de_len;
370 int ret = 0; 370 int ret = 0;
371 371
372 mlog_entry_void();
373
374 de_buf = first_de; 372 de_buf = first_de;
375 dlimit = de_buf + bytes; 373 dlimit = de_buf + bytes;
376 374
@@ -404,7 +402,7 @@ static int inline ocfs2_search_dirblock(struct buffer_head *bh,
404 } 402 }
405 403
406bail: 404bail:
407 mlog_exit(ret); 405 trace_ocfs2_search_dirblock(ret);
408 return ret; 406 return ret;
409} 407}
410 408
@@ -449,8 +447,7 @@ static int ocfs2_validate_dir_block(struct super_block *sb,
449 * We don't validate dirents here, that's handled 447 * We don't validate dirents here, that's handled
450 * in-place when the code walks them. 448 * in-place when the code walks them.
451 */ 449 */
452 mlog(0, "Validating dirblock %llu\n", 450 trace_ocfs2_validate_dir_block((unsigned long long)bh->b_blocknr);
453 (unsigned long long)bh->b_blocknr);
454 451
455 BUG_ON(!buffer_uptodate(bh)); 452 BUG_ON(!buffer_uptodate(bh));
456 453
@@ -708,8 +705,6 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
708 int num = 0; 705 int num = 0;
709 int nblocks, i, err; 706 int nblocks, i, err;
710 707
711 mlog_entry_void();
712
713 sb = dir->i_sb; 708 sb = dir->i_sb;
714 709
715 nblocks = i_size_read(dir) >> sb->s_blocksize_bits; 710 nblocks = i_size_read(dir) >> sb->s_blocksize_bits;
@@ -790,7 +785,7 @@ cleanup_and_exit:
790 for (; ra_ptr < ra_max; ra_ptr++) 785 for (; ra_ptr < ra_max; ra_ptr++)
791 brelse(bh_use[ra_ptr]); 786 brelse(bh_use[ra_ptr]);
792 787
793 mlog_exit_ptr(ret); 788 trace_ocfs2_find_entry_el(ret);
794 return ret; 789 return ret;
795} 790}
796 791
@@ -952,11 +947,9 @@ static int ocfs2_dx_dir_search(const char *name, int namelen,
952 goto out; 947 goto out;
953 } 948 }
954 949
955 mlog(0, "Dir %llu: name: \"%.*s\", lookup of hash: %u.0x%x " 950 trace_ocfs2_dx_dir_search((unsigned long long)OCFS2_I(dir)->ip_blkno,
956 "returns: %llu\n", 951 namelen, name, hinfo->major_hash,
957 (unsigned long long)OCFS2_I(dir)->ip_blkno, 952 hinfo->minor_hash, (unsigned long long)phys);
958 namelen, name, hinfo->major_hash, hinfo->minor_hash,
959 (unsigned long long)phys);
960 953
961 ret = ocfs2_read_dx_leaf(dir, phys, &dx_leaf_bh); 954 ret = ocfs2_read_dx_leaf(dir, phys, &dx_leaf_bh);
962 if (ret) { 955 if (ret) {
@@ -966,9 +959,9 @@ static int ocfs2_dx_dir_search(const char *name, int namelen,
966 959
967 dx_leaf = (struct ocfs2_dx_leaf *) dx_leaf_bh->b_data; 960 dx_leaf = (struct ocfs2_dx_leaf *) dx_leaf_bh->b_data;
968 961
969 mlog(0, "leaf info: num_used: %d, count: %d\n", 962 trace_ocfs2_dx_dir_search_leaf_info(
970 le16_to_cpu(dx_leaf->dl_list.de_num_used), 963 le16_to_cpu(dx_leaf->dl_list.de_num_used),
971 le16_to_cpu(dx_leaf->dl_list.de_count)); 964 le16_to_cpu(dx_leaf->dl_list.de_count));
972 965
973 entry_list = &dx_leaf->dl_list; 966 entry_list = &dx_leaf->dl_list;
974 967
@@ -1168,8 +1161,6 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
1168 int i, status = -ENOENT; 1161 int i, status = -ENOENT;
1169 ocfs2_journal_access_func access = ocfs2_journal_access_db; 1162 ocfs2_journal_access_func access = ocfs2_journal_access_db;
1170 1163
1171 mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", handle, dir, de_del, bh);
1172
1173 if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) 1164 if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
1174 access = ocfs2_journal_access_di; 1165 access = ocfs2_journal_access_di;
1175 1166
@@ -1204,7 +1195,6 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
1204 de = (struct ocfs2_dir_entry *)((char *)de + le16_to_cpu(de->rec_len)); 1195 de = (struct ocfs2_dir_entry *)((char *)de + le16_to_cpu(de->rec_len));
1205 } 1196 }
1206bail: 1197bail:
1207 mlog_exit(status);
1208 return status; 1198 return status;
1209} 1199}
1210 1200
@@ -1350,8 +1340,8 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir,
1350 } 1340 }
1351 } 1341 }
1352 1342
1353 mlog(0, "Dir %llu: delete entry at index: %d\n", 1343 trace_ocfs2_delete_entry_dx((unsigned long long)OCFS2_I(dir)->ip_blkno,
1354 (unsigned long long)OCFS2_I(dir)->ip_blkno, index); 1344 index);
1355 1345
1356 ret = __ocfs2_delete_entry(handle, dir, lookup->dl_entry, 1346 ret = __ocfs2_delete_entry(handle, dir, lookup->dl_entry,
1357 leaf_bh, leaf_bh->b_data, leaf_bh->b_size); 1347 leaf_bh, leaf_bh->b_data, leaf_bh->b_size);
@@ -1634,8 +1624,6 @@ int __ocfs2_add_entry(handle_t *handle,
1634 struct buffer_head *insert_bh = lookup->dl_leaf_bh; 1624 struct buffer_head *insert_bh = lookup->dl_leaf_bh;
1635 char *data_start = insert_bh->b_data; 1625 char *data_start = insert_bh->b_data;
1636 1626
1637 mlog_entry_void();
1638
1639 if (!namelen) 1627 if (!namelen)
1640 return -EINVAL; 1628 return -EINVAL;
1641 1629
@@ -1767,8 +1755,9 @@ int __ocfs2_add_entry(handle_t *handle,
1767 * from ever getting here. */ 1755 * from ever getting here. */
1768 retval = -ENOSPC; 1756 retval = -ENOSPC;
1769bail: 1757bail:
1758 if (retval)
1759 mlog_errno(retval);
1770 1760
1771 mlog_exit(retval);
1772 return retval; 1761 return retval;
1773} 1762}
1774 1763
@@ -2030,8 +2019,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
2030 struct inode *inode = filp->f_path.dentry->d_inode; 2019 struct inode *inode = filp->f_path.dentry->d_inode;
2031 int lock_level = 0; 2020 int lock_level = 0;
2032 2021
2033 mlog_entry("dirino=%llu\n", 2022 trace_ocfs2_readdir((unsigned long long)OCFS2_I(inode)->ip_blkno);
2034 (unsigned long long)OCFS2_I(inode)->ip_blkno);
2035 2023
2036 error = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level); 2024 error = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level);
2037 if (lock_level && error >= 0) { 2025 if (lock_level && error >= 0) {
@@ -2053,9 +2041,10 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
2053 dirent, filldir, NULL); 2041 dirent, filldir, NULL);
2054 2042
2055 ocfs2_inode_unlock(inode, lock_level); 2043 ocfs2_inode_unlock(inode, lock_level);
2044 if (error)
2045 mlog_errno(error);
2056 2046
2057bail_nolock: 2047bail_nolock:
2058 mlog_exit(error);
2059 2048
2060 return error; 2049 return error;
2061} 2050}
@@ -2071,8 +2060,8 @@ int ocfs2_find_files_on_disk(const char *name,
2071{ 2060{
2072 int status = -ENOENT; 2061 int status = -ENOENT;
2073 2062
2074 mlog(0, "name=%.*s, blkno=%p, inode=%llu\n", namelen, name, blkno, 2063 trace_ocfs2_find_files_on_disk(namelen, name, blkno,
2075 (unsigned long long)OCFS2_I(inode)->ip_blkno); 2064 (unsigned long long)OCFS2_I(inode)->ip_blkno);
2076 2065
2077 status = ocfs2_find_entry(name, namelen, inode, lookup); 2066 status = ocfs2_find_entry(name, namelen, inode, lookup);
2078 if (status) 2067 if (status)
@@ -2116,8 +2105,8 @@ int ocfs2_check_dir_for_entry(struct inode *dir,
2116 int ret; 2105 int ret;
2117 struct ocfs2_dir_lookup_result lookup = { NULL, }; 2106 struct ocfs2_dir_lookup_result lookup = { NULL, };
2118 2107
2119 mlog_entry("dir %llu, name '%.*s'\n", 2108 trace_ocfs2_check_dir_for_entry(
2120 (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name); 2109 (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name);
2121 2110
2122 ret = -EEXIST; 2111 ret = -EEXIST;
2123 if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0) 2112 if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0)
@@ -2127,7 +2116,8 @@ int ocfs2_check_dir_for_entry(struct inode *dir,
2127bail: 2116bail:
2128 ocfs2_free_dir_lookup_result(&lookup); 2117 ocfs2_free_dir_lookup_result(&lookup);
2129 2118
2130 mlog_exit(ret); 2119 if (ret)
2120 mlog_errno(ret);
2131 return ret; 2121 return ret;
2132} 2122}
2133 2123
@@ -2326,8 +2316,6 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
2326 struct buffer_head *new_bh = NULL; 2316 struct buffer_head *new_bh = NULL;
2327 struct ocfs2_dir_entry *de; 2317 struct ocfs2_dir_entry *de;
2328 2318
2329 mlog_entry_void();
2330
2331 if (ocfs2_new_dir_wants_trailer(inode)) 2319 if (ocfs2_new_dir_wants_trailer(inode))
2332 size = ocfs2_dir_trailer_blk_off(parent->i_sb); 2320 size = ocfs2_dir_trailer_blk_off(parent->i_sb);
2333 2321
@@ -2382,7 +2370,6 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
2382bail: 2370bail:
2383 brelse(new_bh); 2371 brelse(new_bh);
2384 2372
2385 mlog_exit(status);
2386 return status; 2373 return status;
2387} 2374}
2388 2375
@@ -2411,9 +2398,9 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
2411 goto out; 2398 goto out;
2412 } 2399 }
2413 2400
2414 mlog(0, "Dir %llu, attach new index block: %llu\n", 2401 trace_ocfs2_dx_dir_attach_index(
2415 (unsigned long long)OCFS2_I(dir)->ip_blkno, 2402 (unsigned long long)OCFS2_I(dir)->ip_blkno,
2416 (unsigned long long)dr_blkno); 2403 (unsigned long long)dr_blkno);
2417 2404
2418 dx_root_bh = sb_getblk(osb->sb, dr_blkno); 2405 dx_root_bh = sb_getblk(osb->sb, dr_blkno);
2419 if (dx_root_bh == NULL) { 2406 if (dx_root_bh == NULL) {
@@ -2513,11 +2500,10 @@ static int ocfs2_dx_dir_format_cluster(struct ocfs2_super *osb,
2513 dx_leaf->dl_list.de_count = 2500 dx_leaf->dl_list.de_count =
2514 cpu_to_le16(ocfs2_dx_entries_per_leaf(osb->sb)); 2501 cpu_to_le16(ocfs2_dx_entries_per_leaf(osb->sb));
2515 2502
2516 mlog(0, 2503 trace_ocfs2_dx_dir_format_cluster(
2517 "Dir %llu, format dx_leaf: %llu, entry count: %u\n", 2504 (unsigned long long)OCFS2_I(dir)->ip_blkno,
2518 (unsigned long long)OCFS2_I(dir)->ip_blkno, 2505 (unsigned long long)bh->b_blocknr,
2519 (unsigned long long)bh->b_blocknr, 2506 le16_to_cpu(dx_leaf->dl_list.de_count));
2520 le16_to_cpu(dx_leaf->dl_list.de_count));
2521 2507
2522 ocfs2_journal_dirty(handle, bh); 2508 ocfs2_journal_dirty(handle, bh);
2523 } 2509 }
@@ -2761,12 +2747,11 @@ static void ocfs2_dx_dir_index_root_block(struct inode *dir,
2761 2747
2762 ocfs2_dx_dir_name_hash(dir, de->name, de->name_len, &hinfo); 2748 ocfs2_dx_dir_name_hash(dir, de->name, de->name_len, &hinfo);
2763 2749
2764 mlog(0, 2750 trace_ocfs2_dx_dir_index_root_block(
2765 "dir: %llu, major: 0x%x minor: 0x%x, index: %u, name: %.*s\n", 2751 (unsigned long long)dir->i_ino,
2766 (unsigned long long)dir->i_ino, hinfo.major_hash, 2752 hinfo.major_hash, hinfo.minor_hash,
2767 hinfo.minor_hash, 2753 de->name_len, de->name,
2768 le16_to_cpu(dx_root->dr_entries.de_num_used), 2754 le16_to_cpu(dx_root->dr_entries.de_num_used));
2769 de->name_len, de->name);
2770 2755
2771 ocfs2_dx_entry_list_insert(&dx_root->dr_entries, &hinfo, 2756 ocfs2_dx_entry_list_insert(&dx_root->dr_entries, &hinfo,
2772 dirent_blk); 2757 dirent_blk);
@@ -3237,7 +3222,6 @@ static int ocfs2_do_extend_dir(struct super_block *sb,
3237bail: 3222bail:
3238 if (did_quota && status < 0) 3223 if (did_quota && status < 0)
3239 dquot_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1)); 3224 dquot_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1));
3240 mlog_exit(status);
3241 return status; 3225 return status;
3242} 3226}
3243 3227
@@ -3272,8 +3256,6 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
3272 struct ocfs2_extent_tree et; 3256 struct ocfs2_extent_tree et;
3273 struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh; 3257 struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh;
3274 3258
3275 mlog_entry_void();
3276
3277 if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { 3259 if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
3278 /* 3260 /*
3279 * This would be a code error as an inline directory should 3261 * This would be a code error as an inline directory should
@@ -3322,8 +3304,8 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
3322 down_write(&OCFS2_I(dir)->ip_alloc_sem); 3304 down_write(&OCFS2_I(dir)->ip_alloc_sem);
3323 drop_alloc_sem = 1; 3305 drop_alloc_sem = 1;
3324 dir_i_size = i_size_read(dir); 3306 dir_i_size = i_size_read(dir);
3325 mlog(0, "extending dir %llu (i_size = %lld)\n", 3307 trace_ocfs2_extend_dir((unsigned long long)OCFS2_I(dir)->ip_blkno,
3326 (unsigned long long)OCFS2_I(dir)->ip_blkno, dir_i_size); 3308 dir_i_size);
3327 3309
3328 /* dir->i_size is always block aligned. */ 3310 /* dir->i_size is always block aligned. */
3329 spin_lock(&OCFS2_I(dir)->ip_lock); 3311 spin_lock(&OCFS2_I(dir)->ip_lock);
@@ -3438,7 +3420,6 @@ bail:
3438 3420
3439 brelse(new_bh); 3421 brelse(new_bh);
3440 3422
3441 mlog_exit(status);
3442 return status; 3423 return status;
3443} 3424}
3444 3425
@@ -3585,8 +3566,9 @@ next:
3585 status = 0; 3566 status = 0;
3586bail: 3567bail:
3587 brelse(bh); 3568 brelse(bh);
3569 if (status)
3570 mlog_errno(status);
3588 3571
3589 mlog_exit(status);
3590 return status; 3572 return status;
3591} 3573}
3592 3574
@@ -3817,9 +3799,9 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
3817 struct ocfs2_dx_root_block *dx_root; 3799 struct ocfs2_dx_root_block *dx_root;
3818 struct ocfs2_dx_leaf *tmp_dx_leaf = NULL; 3800 struct ocfs2_dx_leaf *tmp_dx_leaf = NULL;
3819 3801
3820 mlog(0, "DX Dir: %llu, rebalance leaf leaf_blkno: %llu insert: %u\n", 3802 trace_ocfs2_dx_dir_rebalance((unsigned long long)OCFS2_I(dir)->ip_blkno,
3821 (unsigned long long)OCFS2_I(dir)->ip_blkno, 3803 (unsigned long long)leaf_blkno,
3822 (unsigned long long)leaf_blkno, insert_hash); 3804 insert_hash);
3823 3805
3824 ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh); 3806 ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh);
3825 3807
@@ -3899,8 +3881,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir,
3899 goto out_commit; 3881 goto out_commit;
3900 } 3882 }
3901 3883
3902 mlog(0, "Split leaf (%u) at %u, insert major hash is %u\n", 3884 trace_ocfs2_dx_dir_rebalance_split(leaf_cpos, split_hash, insert_hash);
3903 leaf_cpos, split_hash, insert_hash);
3904 3885
3905 /* 3886 /*
3906 * We have to carefully order operations here. There are items 3887 * We have to carefully order operations here. There are items
@@ -4357,8 +4338,8 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb,
4357 unsigned int blocks_wanted = 1; 4338 unsigned int blocks_wanted = 1;
4358 struct buffer_head *bh = NULL; 4339 struct buffer_head *bh = NULL;
4359 4340
4360 mlog(0, "getting ready to insert namelen %d into dir %llu\n", 4341 trace_ocfs2_prepare_dir_for_insert(
4361 namelen, (unsigned long long)OCFS2_I(dir)->ip_blkno); 4342 (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen);
4362 4343
4363 if (!namelen) { 4344 if (!namelen) {
4364 ret = -EINVAL; 4345 ret = -EINVAL;