diff options
author | Joel Becker <joel.becker@oracle.com> | 2009-02-12 19:41:25 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-09-04 19:07:50 -0400 |
commit | 0cf2f7632b1789b811ab20b611c4156e6de2b055 (patch) | |
tree | 34f7cf3584e4fa2bc187d4b75ce052cb98739b0e /fs/ocfs2/dir.c | |
parent | 292dd27ec76b96cebcef576f330ab121f59ccf05 (diff) |
ocfs2: Pass struct ocfs2_caching_info to the journal functions.
The next step in divorcing metadata I/O management from struct inode is
to pass struct ocfs2_caching_info to the journal functions. Thus the
journal locks a metadata cache with the cache io_lock function. It also
can compare ci_last_trans and ci_created_trans directly.
This is a large patch because of all the places we change
ocfs2_journal_access..(handle, inode, ...) to
ocfs2_journal_access..(handle, INODE_CACHE(inode), ...).
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/dir.c')
-rw-r--r-- | fs/ocfs2/dir.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 273fb7648fce..073ab34b8c2a 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -176,7 +176,7 @@ static int ocfs2_dx_dir_link_trailer(struct inode *dir, handle_t *handle, | |||
176 | struct ocfs2_dx_root_block *dx_root; | 176 | struct ocfs2_dx_root_block *dx_root; |
177 | struct ocfs2_dir_block_trailer *trailer; | 177 | struct ocfs2_dir_block_trailer *trailer; |
178 | 178 | ||
179 | ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, | 179 | ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh, |
180 | OCFS2_JOURNAL_ACCESS_WRITE); | 180 | OCFS2_JOURNAL_ACCESS_WRITE); |
181 | if (ret) { | 181 | if (ret) { |
182 | mlog_errno(ret); | 182 | mlog_errno(ret); |
@@ -1136,7 +1136,8 @@ int ocfs2_update_entry(struct inode *dir, handle_t *handle, | |||
1136 | if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) | 1136 | if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) |
1137 | access = ocfs2_journal_access_di; | 1137 | access = ocfs2_journal_access_di; |
1138 | 1138 | ||
1139 | ret = access(handle, dir, de_bh, OCFS2_JOURNAL_ACCESS_WRITE); | 1139 | ret = access(handle, INODE_CACHE(dir), de_bh, |
1140 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
1140 | if (ret) { | 1141 | if (ret) { |
1141 | mlog_errno(ret); | 1142 | mlog_errno(ret); |
1142 | goto out; | 1143 | goto out; |
@@ -1179,7 +1180,7 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir, | |||
1179 | goto bail; | 1180 | goto bail; |
1180 | } | 1181 | } |
1181 | if (de == de_del) { | 1182 | if (de == de_del) { |
1182 | status = access(handle, dir, bh, | 1183 | status = access(handle, INODE_CACHE(dir), bh, |
1183 | OCFS2_JOURNAL_ACCESS_WRITE); | 1184 | OCFS2_JOURNAL_ACCESS_WRITE); |
1184 | if (status < 0) { | 1185 | if (status < 0) { |
1185 | status = -EIO; | 1186 | status = -EIO; |
@@ -1329,7 +1330,7 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir, | |||
1329 | * the entry count needs to be updated. Also, we might be | 1330 | * the entry count needs to be updated. Also, we might be |
1330 | * adding to the start of the free list. | 1331 | * adding to the start of the free list. |
1331 | */ | 1332 | */ |
1332 | ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, | 1333 | ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh, |
1333 | OCFS2_JOURNAL_ACCESS_WRITE); | 1334 | OCFS2_JOURNAL_ACCESS_WRITE); |
1334 | if (ret) { | 1335 | if (ret) { |
1335 | mlog_errno(ret); | 1336 | mlog_errno(ret); |
@@ -1337,7 +1338,7 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir, | |||
1337 | } | 1338 | } |
1338 | 1339 | ||
1339 | if (!ocfs2_dx_root_inline(dx_root)) { | 1340 | if (!ocfs2_dx_root_inline(dx_root)) { |
1340 | ret = ocfs2_journal_access_dl(handle, dir, | 1341 | ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), |
1341 | lookup->dl_dx_leaf_bh, | 1342 | lookup->dl_dx_leaf_bh, |
1342 | OCFS2_JOURNAL_ACCESS_WRITE); | 1343 | OCFS2_JOURNAL_ACCESS_WRITE); |
1343 | if (ret) { | 1344 | if (ret) { |
@@ -1496,7 +1497,7 @@ static int __ocfs2_dx_dir_leaf_insert(struct inode *dir, handle_t *handle, | |||
1496 | int ret; | 1497 | int ret; |
1497 | struct ocfs2_dx_leaf *dx_leaf; | 1498 | struct ocfs2_dx_leaf *dx_leaf; |
1498 | 1499 | ||
1499 | ret = ocfs2_journal_access_dl(handle, dir, dx_leaf_bh, | 1500 | ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), dx_leaf_bh, |
1500 | OCFS2_JOURNAL_ACCESS_WRITE); | 1501 | OCFS2_JOURNAL_ACCESS_WRITE); |
1501 | if (ret) { | 1502 | if (ret) { |
1502 | mlog_errno(ret); | 1503 | mlog_errno(ret); |
@@ -1526,7 +1527,7 @@ static int ocfs2_dx_dir_insert(struct inode *dir, handle_t *handle, | |||
1526 | struct ocfs2_dx_root_block *dx_root; | 1527 | struct ocfs2_dx_root_block *dx_root; |
1527 | struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh; | 1528 | struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh; |
1528 | 1529 | ||
1529 | ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, | 1530 | ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh, |
1530 | OCFS2_JOURNAL_ACCESS_WRITE); | 1531 | OCFS2_JOURNAL_ACCESS_WRITE); |
1531 | if (ret) { | 1532 | if (ret) { |
1532 | mlog_errno(ret); | 1533 | mlog_errno(ret); |
@@ -1648,11 +1649,13 @@ int __ocfs2_add_entry(handle_t *handle, | |||
1648 | */ | 1649 | */ |
1649 | if (ocfs2_free_list_at_root(lookup)) { | 1650 | if (ocfs2_free_list_at_root(lookup)) { |
1650 | bh = lookup->dl_dx_root_bh; | 1651 | bh = lookup->dl_dx_root_bh; |
1651 | retval = ocfs2_journal_access_dr(handle, dir, bh, | 1652 | retval = ocfs2_journal_access_dr(handle, |
1653 | INODE_CACHE(dir), bh, | ||
1652 | OCFS2_JOURNAL_ACCESS_WRITE); | 1654 | OCFS2_JOURNAL_ACCESS_WRITE); |
1653 | } else { | 1655 | } else { |
1654 | bh = lookup->dl_prev_leaf_bh; | 1656 | bh = lookup->dl_prev_leaf_bh; |
1655 | retval = ocfs2_journal_access_db(handle, dir, bh, | 1657 | retval = ocfs2_journal_access_db(handle, |
1658 | INODE_CACHE(dir), bh, | ||
1656 | OCFS2_JOURNAL_ACCESS_WRITE); | 1659 | OCFS2_JOURNAL_ACCESS_WRITE); |
1657 | } | 1660 | } |
1658 | if (retval) { | 1661 | if (retval) { |
@@ -1703,11 +1706,13 @@ int __ocfs2_add_entry(handle_t *handle, | |||
1703 | } | 1706 | } |
1704 | 1707 | ||
1705 | if (insert_bh == parent_fe_bh) | 1708 | if (insert_bh == parent_fe_bh) |
1706 | status = ocfs2_journal_access_di(handle, dir, | 1709 | status = ocfs2_journal_access_di(handle, |
1710 | INODE_CACHE(dir), | ||
1707 | insert_bh, | 1711 | insert_bh, |
1708 | OCFS2_JOURNAL_ACCESS_WRITE); | 1712 | OCFS2_JOURNAL_ACCESS_WRITE); |
1709 | else { | 1713 | else { |
1710 | status = ocfs2_journal_access_db(handle, dir, | 1714 | status = ocfs2_journal_access_db(handle, |
1715 | INODE_CACHE(dir), | ||
1711 | insert_bh, | 1716 | insert_bh, |
1712 | OCFS2_JOURNAL_ACCESS_WRITE); | 1717 | OCFS2_JOURNAL_ACCESS_WRITE); |
1713 | 1718 | ||
@@ -2283,7 +2288,7 @@ static int ocfs2_fill_new_dir_id(struct ocfs2_super *osb, | |||
2283 | struct ocfs2_inline_data *data = &di->id2.i_data; | 2288 | struct ocfs2_inline_data *data = &di->id2.i_data; |
2284 | unsigned int size = le16_to_cpu(data->id_count); | 2289 | unsigned int size = le16_to_cpu(data->id_count); |
2285 | 2290 | ||
2286 | ret = ocfs2_journal_access_di(handle, inode, di_bh, | 2291 | ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh, |
2287 | OCFS2_JOURNAL_ACCESS_WRITE); | 2292 | OCFS2_JOURNAL_ACCESS_WRITE); |
2288 | if (ret) { | 2293 | if (ret) { |
2289 | mlog_errno(ret); | 2294 | mlog_errno(ret); |
@@ -2337,7 +2342,7 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb, | |||
2337 | 2342 | ||
2338 | ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh); | 2343 | ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh); |
2339 | 2344 | ||
2340 | status = ocfs2_journal_access_db(handle, inode, new_bh, | 2345 | status = ocfs2_journal_access_db(handle, INODE_CACHE(inode), new_bh, |
2341 | OCFS2_JOURNAL_ACCESS_CREATE); | 2346 | OCFS2_JOURNAL_ACCESS_CREATE); |
2342 | if (status < 0) { | 2347 | if (status < 0) { |
2343 | mlog_errno(status); | 2348 | mlog_errno(status); |
@@ -2423,7 +2428,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb, | |||
2423 | } | 2428 | } |
2424 | ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dx_root_bh); | 2429 | ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dx_root_bh); |
2425 | 2430 | ||
2426 | ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, | 2431 | ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh, |
2427 | OCFS2_JOURNAL_ACCESS_CREATE); | 2432 | OCFS2_JOURNAL_ACCESS_CREATE); |
2428 | if (ret < 0) { | 2433 | if (ret < 0) { |
2429 | mlog_errno(ret); | 2434 | mlog_errno(ret); |
@@ -2457,7 +2462,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb, | |||
2457 | if (ret) | 2462 | if (ret) |
2458 | mlog_errno(ret); | 2463 | mlog_errno(ret); |
2459 | 2464 | ||
2460 | ret = ocfs2_journal_access_di(handle, dir, di_bh, | 2465 | ret = ocfs2_journal_access_di(handle, INODE_CACHE(dir), di_bh, |
2461 | OCFS2_JOURNAL_ACCESS_CREATE); | 2466 | OCFS2_JOURNAL_ACCESS_CREATE); |
2462 | if (ret) { | 2467 | if (ret) { |
2463 | mlog_errno(ret); | 2468 | mlog_errno(ret); |
@@ -2500,7 +2505,7 @@ static int ocfs2_dx_dir_format_cluster(struct ocfs2_super *osb, | |||
2500 | 2505 | ||
2501 | ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), bh); | 2506 | ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), bh); |
2502 | 2507 | ||
2503 | ret = ocfs2_journal_access_dl(handle, dir, bh, | 2508 | ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), bh, |
2504 | OCFS2_JOURNAL_ACCESS_CREATE); | 2509 | OCFS2_JOURNAL_ACCESS_CREATE); |
2505 | if (ret < 0) { | 2510 | if (ret < 0) { |
2506 | mlog_errno(ret); | 2511 | mlog_errno(ret); |
@@ -3010,7 +3015,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
3010 | 3015 | ||
3011 | ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dirdata_bh); | 3016 | ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), dirdata_bh); |
3012 | 3017 | ||
3013 | ret = ocfs2_journal_access_db(handle, dir, dirdata_bh, | 3018 | ret = ocfs2_journal_access_db(handle, INODE_CACHE(dir), dirdata_bh, |
3014 | OCFS2_JOURNAL_ACCESS_CREATE); | 3019 | OCFS2_JOURNAL_ACCESS_CREATE); |
3015 | if (ret) { | 3020 | if (ret) { |
3016 | mlog_errno(ret); | 3021 | mlog_errno(ret); |
@@ -3063,7 +3068,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
3063 | * We let the later dirent insert modify c/mtime - to the user | 3068 | * We let the later dirent insert modify c/mtime - to the user |
3064 | * the data hasn't changed. | 3069 | * the data hasn't changed. |
3065 | */ | 3070 | */ |
3066 | ret = ocfs2_journal_access_di(handle, dir, di_bh, | 3071 | ret = ocfs2_journal_access_di(handle, INODE_CACHE(dir), di_bh, |
3067 | OCFS2_JOURNAL_ACCESS_CREATE); | 3072 | OCFS2_JOURNAL_ACCESS_CREATE); |
3068 | if (ret) { | 3073 | if (ret) { |
3069 | mlog_errno(ret); | 3074 | mlog_errno(ret); |
@@ -3392,7 +3397,7 @@ do_extend: | |||
3392 | 3397 | ||
3393 | ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), new_bh); | 3398 | ocfs2_set_new_buffer_uptodate(INODE_CACHE(dir), new_bh); |
3394 | 3399 | ||
3395 | status = ocfs2_journal_access_db(handle, dir, new_bh, | 3400 | status = ocfs2_journal_access_db(handle, INODE_CACHE(dir), new_bh, |
3396 | OCFS2_JOURNAL_ACCESS_CREATE); | 3401 | OCFS2_JOURNAL_ACCESS_CREATE); |
3397 | if (status < 0) { | 3402 | if (status < 0) { |
3398 | mlog_errno(status); | 3403 | mlog_errno(status); |
@@ -3888,7 +3893,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir, | |||
3888 | } | 3893 | } |
3889 | did_quota = 1; | 3894 | did_quota = 1; |
3890 | 3895 | ||
3891 | ret = ocfs2_journal_access_dl(handle, dir, dx_leaf_bh, | 3896 | ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), dx_leaf_bh, |
3892 | OCFS2_JOURNAL_ACCESS_WRITE); | 3897 | OCFS2_JOURNAL_ACCESS_WRITE); |
3893 | if (ret) { | 3898 | if (ret) { |
3894 | mlog_errno(ret); | 3899 | mlog_errno(ret); |
@@ -3952,7 +3957,8 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir, | |||
3952 | } | 3957 | } |
3953 | 3958 | ||
3954 | for (i = 0; i < num_dx_leaves; i++) { | 3959 | for (i = 0; i < num_dx_leaves; i++) { |
3955 | ret = ocfs2_journal_access_dl(handle, dir, orig_dx_leaves[i], | 3960 | ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), |
3961 | orig_dx_leaves[i], | ||
3956 | OCFS2_JOURNAL_ACCESS_WRITE); | 3962 | OCFS2_JOURNAL_ACCESS_WRITE); |
3957 | if (ret) { | 3963 | if (ret) { |
3958 | mlog_errno(ret); | 3964 | mlog_errno(ret); |
@@ -4168,7 +4174,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir, | |||
4168 | * failure to add the dx_root_bh to the journal won't result | 4174 | * failure to add the dx_root_bh to the journal won't result |
4169 | * us losing clusters. | 4175 | * us losing clusters. |
4170 | */ | 4176 | */ |
4171 | ret = ocfs2_journal_access_dr(handle, dir, dx_root_bh, | 4177 | ret = ocfs2_journal_access_dr(handle, INODE_CACHE(dir), dx_root_bh, |
4172 | OCFS2_JOURNAL_ACCESS_WRITE); | 4178 | OCFS2_JOURNAL_ACCESS_WRITE); |
4173 | if (ret) { | 4179 | if (ret) { |
4174 | mlog_errno(ret); | 4180 | mlog_errno(ret); |
@@ -4472,7 +4478,7 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir, | |||
4472 | goto out_unlock; | 4478 | goto out_unlock; |
4473 | } | 4479 | } |
4474 | 4480 | ||
4475 | ret = ocfs2_journal_access_di(handle, dir, di_bh, | 4481 | ret = ocfs2_journal_access_di(handle, INODE_CACHE(dir), di_bh, |
4476 | OCFS2_JOURNAL_ACCESS_WRITE); | 4482 | OCFS2_JOURNAL_ACCESS_WRITE); |
4477 | if (ret) { | 4483 | if (ret) { |
4478 | mlog_errno(ret); | 4484 | mlog_errno(ret); |