diff options
author | Nikolay Borisov <nborisov@suse.com> | 2017-02-20 06:51:01 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-02-28 05:30:10 -0500 |
commit | 19df27a9e47085dcc81cbf9e7b464e7402511e18 (patch) | |
tree | f8c66c083d5b624f56fce818bf2e43667a3528d7 /fs/btrfs/tree-log.c | |
parent | aefa6115c04ee561302e133ab5916246cd3695f7 (diff) |
btrfs: make btrfs_log_inode_parent take btrfs_inode
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 399561b039c3..f8965b081212 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -5390,7 +5390,8 @@ out: | |||
5390 | * the last committed transaction | 5390 | * the last committed transaction |
5391 | */ | 5391 | */ |
5392 | static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | 5392 | static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, |
5393 | struct btrfs_root *root, struct inode *inode, | 5393 | struct btrfs_root *root, |
5394 | struct btrfs_inode *inode, | ||
5394 | struct dentry *parent, | 5395 | struct dentry *parent, |
5395 | const loff_t start, | 5396 | const loff_t start, |
5396 | const loff_t end, | 5397 | const loff_t end, |
@@ -5404,9 +5405,9 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
5404 | int ret = 0; | 5405 | int ret = 0; |
5405 | u64 last_committed = fs_info->last_trans_committed; | 5406 | u64 last_committed = fs_info->last_trans_committed; |
5406 | bool log_dentries = false; | 5407 | bool log_dentries = false; |
5407 | struct inode *orig_inode = inode; | 5408 | struct btrfs_inode *orig_inode = inode; |
5408 | 5409 | ||
5409 | sb = inode->i_sb; | 5410 | sb = inode->vfs_inode.i_sb; |
5410 | 5411 | ||
5411 | if (btrfs_test_opt(fs_info, NOTREELOG)) { | 5412 | if (btrfs_test_opt(fs_info, NOTREELOG)) { |
5412 | ret = 1; | 5413 | ret = 1; |
@@ -5423,18 +5424,17 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
5423 | goto end_no_trans; | 5424 | goto end_no_trans; |
5424 | } | 5425 | } |
5425 | 5426 | ||
5426 | if (root != BTRFS_I(inode)->root || | 5427 | if (root != inode->root || btrfs_root_refs(&root->root_item) == 0) { |
5427 | btrfs_root_refs(&root->root_item) == 0) { | ||
5428 | ret = 1; | 5428 | ret = 1; |
5429 | goto end_no_trans; | 5429 | goto end_no_trans; |
5430 | } | 5430 | } |
5431 | 5431 | ||
5432 | ret = check_parent_dirs_for_sync(trans, BTRFS_I(inode), parent, | 5432 | ret = check_parent_dirs_for_sync(trans, inode, parent, sb, |
5433 | sb, last_committed); | 5433 | last_committed); |
5434 | if (ret) | 5434 | if (ret) |
5435 | goto end_no_trans; | 5435 | goto end_no_trans; |
5436 | 5436 | ||
5437 | if (btrfs_inode_in_log(BTRFS_I(inode), trans->transid)) { | 5437 | if (btrfs_inode_in_log(inode, trans->transid)) { |
5438 | ret = BTRFS_NO_LOG_SYNC; | 5438 | ret = BTRFS_NO_LOG_SYNC; |
5439 | goto end_no_trans; | 5439 | goto end_no_trans; |
5440 | } | 5440 | } |
@@ -5443,8 +5443,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
5443 | if (ret) | 5443 | if (ret) |
5444 | goto end_no_trans; | 5444 | goto end_no_trans; |
5445 | 5445 | ||
5446 | ret = btrfs_log_inode(trans, root, BTRFS_I(inode), inode_only, | 5446 | ret = btrfs_log_inode(trans, root, inode, inode_only, start, end, ctx); |
5447 | start, end, ctx); | ||
5448 | if (ret) | 5447 | if (ret) |
5449 | goto end_trans; | 5448 | goto end_trans; |
5450 | 5449 | ||
@@ -5454,14 +5453,14 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
5454 | * we can use the last_unlink_trans field to record renames | 5453 | * we can use the last_unlink_trans field to record renames |
5455 | * and other fun in this file. | 5454 | * and other fun in this file. |
5456 | */ | 5455 | */ |
5457 | if (S_ISREG(inode->i_mode) && | 5456 | if (S_ISREG(inode->vfs_inode.i_mode) && |
5458 | BTRFS_I(inode)->generation <= last_committed && | 5457 | inode->generation <= last_committed && |
5459 | BTRFS_I(inode)->last_unlink_trans <= last_committed) { | 5458 | inode->last_unlink_trans <= last_committed) { |
5460 | ret = 0; | 5459 | ret = 0; |
5461 | goto end_trans; | 5460 | goto end_trans; |
5462 | } | 5461 | } |
5463 | 5462 | ||
5464 | if (S_ISDIR(inode->i_mode) && ctx && ctx->log_new_dentries) | 5463 | if (S_ISDIR(inode->vfs_inode.i_mode) && ctx && ctx->log_new_dentries) |
5465 | log_dentries = true; | 5464 | log_dentries = true; |
5466 | 5465 | ||
5467 | /* | 5466 | /* |
@@ -5505,8 +5504,8 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
5505 | * but the file inode does not have a matching BTRFS_INODE_REF_KEY item | 5504 | * but the file inode does not have a matching BTRFS_INODE_REF_KEY item |
5506 | * and has a link count of 2. | 5505 | * and has a link count of 2. |
5507 | */ | 5506 | */ |
5508 | if (BTRFS_I(inode)->last_unlink_trans > last_committed) { | 5507 | if (inode->last_unlink_trans > last_committed) { |
5509 | ret = btrfs_log_all_parents(trans, BTRFS_I(orig_inode), ctx); | 5508 | ret = btrfs_log_all_parents(trans, orig_inode, ctx); |
5510 | if (ret) | 5509 | if (ret) |
5511 | goto end_trans; | 5510 | goto end_trans; |
5512 | } | 5511 | } |
@@ -5515,14 +5514,13 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
5515 | if (!parent || d_really_is_negative(parent) || sb != parent->d_sb) | 5514 | if (!parent || d_really_is_negative(parent) || sb != parent->d_sb) |
5516 | break; | 5515 | break; |
5517 | 5516 | ||
5518 | inode = d_inode(parent); | 5517 | inode = BTRFS_I(d_inode(parent)); |
5519 | if (root != BTRFS_I(inode)->root) | 5518 | if (root != inode->root) |
5520 | break; | 5519 | break; |
5521 | 5520 | ||
5522 | if (BTRFS_I(inode)->generation > last_committed) { | 5521 | if (inode->generation > last_committed) { |
5523 | ret = btrfs_log_inode(trans, root, BTRFS_I(inode), | 5522 | ret = btrfs_log_inode(trans, root, inode, |
5524 | LOG_INODE_EXISTS, | 5523 | LOG_INODE_EXISTS, 0, LLONG_MAX, ctx); |
5525 | 0, LLONG_MAX, ctx); | ||
5526 | if (ret) | 5524 | if (ret) |
5527 | goto end_trans; | 5525 | goto end_trans; |
5528 | } | 5526 | } |
@@ -5534,7 +5532,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
5534 | old_parent = parent; | 5532 | old_parent = parent; |
5535 | } | 5533 | } |
5536 | if (log_dentries) | 5534 | if (log_dentries) |
5537 | ret = log_new_dir_dentries(trans, root, BTRFS_I(orig_inode), ctx); | 5535 | ret = log_new_dir_dentries(trans, root, orig_inode, ctx); |
5538 | else | 5536 | else |
5539 | ret = 0; | 5537 | ret = 0; |
5540 | end_trans: | 5538 | end_trans: |
@@ -5566,8 +5564,8 @@ int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, | |||
5566 | struct dentry *parent = dget_parent(dentry); | 5564 | struct dentry *parent = dget_parent(dentry); |
5567 | int ret; | 5565 | int ret; |
5568 | 5566 | ||
5569 | ret = btrfs_log_inode_parent(trans, root, d_inode(dentry), parent, | 5567 | ret = btrfs_log_inode_parent(trans, root, BTRFS_I(d_inode(dentry)), |
5570 | start, end, 0, ctx); | 5568 | parent, start, end, 0, ctx); |
5571 | dput(parent); | 5569 | dput(parent); |
5572 | 5570 | ||
5573 | return ret; | 5571 | return ret; |
@@ -5829,7 +5827,7 @@ int btrfs_log_new_name(struct btrfs_trans_handle *trans, | |||
5829 | (!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed)) | 5827 | (!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed)) |
5830 | return 0; | 5828 | return 0; |
5831 | 5829 | ||
5832 | return btrfs_log_inode_parent(trans, root, &inode->vfs_inode, parent, 0, | 5830 | return btrfs_log_inode_parent(trans, root, inode, parent, 0, |
5833 | LLONG_MAX, 1, NULL); | 5831 | LLONG_MAX, 1, NULL); |
5834 | } | 5832 | } |
5835 | 5833 | ||