* [PATCH 00/24] tree-log inode vs btrfs_inode cleanups
@ 2017-01-12 14:00 Nikolay Borisov
2017-01-12 14:00 ` [PATCH 01/24] btrfs: Make btrfs_must_commit_transaction take btrfs_inode Nikolay Borisov
` (24 more replies)
0 siblings, 25 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
So here is a new set of patches cleaning up tree-log function
w.r.t inode vs btrfs_inode. There are still some which remain
but I didn't find compelling arguments to cleaning them up, so
I've left them unchanged. This time there are some size shrinkage:
text data bss dec hex filename
2530598 174661 28288 2733547 29b5eb fs/btrfs/btrfs.ko - upstream master
text data bss dec hex filename
2530774 174661 28288 2733723 29b69b fs/btrfs/btrfs.ko - before tree-log cleanup
text data bss dec hex filename
2530163 174661 28288 2733112 29b438 fs/btrfs/btrfs.ko - both series applied
So the net result of the 2 series is 435 bytes and I assume there
will be further reduction in size once further cleanups are made
Nikolay Borisov (24):
btrfs: Make btrfs_must_commit_transaction take btrfs_inode
btrfs: Make btrfs_record_unlink_dir take btrfs_inode
btrfs: Make btrfs_record_snapshot_destroy take btrfs_inode
btrfs: Make btrfs_inode_in_log take btrfs_inode
btrfs: Make btrfs_log_new_name take btrfs_inode
btrfs: Make btrfs_del_dir_entries_in_log take btrfs_inode
btrfs: Make btrfs_del_inode_ref take btrfs_inode
btrfs: Make logged_inode_size take btrfs_inode
btrfs: Make btrfs_check_ref_name_override take btrfs_inode
btrfs: Make copy_items take btrfs_inode
btrfs: Make btrfs_log_all_xattrs take btrfs_inode
btrfs: Make btrfs_log_trailing_hole take btrfs_inode
btrfs: Make btrfs_get_logged_extents take btrfs_inode
btrfs: Make btrfs_log_changed_extents take btrfs_inode
btrfs: Make log_dir_items take btrfs_inode
btrfs: Make log_directory_changes take btrfs_inode
btrfs: Make log_new_dir_dentries take btrfs_inode
btrfs: Make btrfs_unlink_inode take btrfs_inode
btrfs: Make drop_one_dir_item take btrfs_inode
btrfs: Make __add_inode_ref take btrfs_inode
btrfs: Make log_inode_item take btrfs_inode
btrfs: Make btrfs_log_inode take btrfs_inode
btrfs: Make count_inode_extrefs take btrfs_inode
btrfs: Make count_inode_refs take btrfs_inode
fs/btrfs/btrfs_inode.h | 16 ++-
fs/btrfs/ctree.h | 2 +-
fs/btrfs/file.c | 2 +-
fs/btrfs/inode.c | 90 ++++++++-------
fs/btrfs/ioctl.c | 2 +-
fs/btrfs/ordered-data.c | 4 +-
fs/btrfs/ordered-data.h | 2 +-
fs/btrfs/tree-log.c | 288 +++++++++++++++++++++++-------------------------
fs/btrfs/tree-log.h | 10 +-
9 files changed, 201 insertions(+), 215 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 01/24] btrfs: Make btrfs_must_commit_transaction take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 02/24] btrfs: Make btrfs_record_unlink_dir " Nikolay Borisov
` (23 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 4e6f081512ab..f6de921e28b0 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5014,13 +5014,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* we logged the inode or it might have also done the unlink).
*/
static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans,
- struct inode *inode)
+ struct btrfs_inode *inode)
{
- struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
+ struct btrfs_fs_info *fs_info = inode->root->fs_info;
bool ret = false;
- mutex_lock(&BTRFS_I(inode)->log_mutex);
- if (BTRFS_I(inode)->last_unlink_trans > fs_info->last_trans_committed) {
+ mutex_lock(&inode->log_mutex);
+ if (inode->last_unlink_trans > fs_info->last_trans_committed) {
/*
* Make sure any commits to the log are forced to be full
* commits.
@@ -5028,7 +5028,7 @@ static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans,
btrfs_set_log_full_commit(fs_info, trans);
ret = true;
}
- mutex_unlock(&BTRFS_I(inode)->log_mutex);
+ mutex_unlock(&inode->log_mutex);
return ret;
}
@@ -5077,7 +5077,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
BTRFS_I(inode)->logged_trans = trans->transid;
smp_mb();
- if (btrfs_must_commit_transaction(trans, inode)) {
+ if (btrfs_must_commit_transaction(trans, BTRFS_I(inode))) {
ret = 1;
break;
}
@@ -5087,7 +5087,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
if (IS_ROOT(parent)) {
inode = d_inode(parent);
- if (btrfs_must_commit_transaction(trans, inode))
+ if (btrfs_must_commit_transaction(trans, BTRFS_I(inode)))
ret = 1;
break;
}
@@ -5241,7 +5241,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
ret = btrfs_log_inode(trans, root, di_inode,
log_mode, 0, LLONG_MAX, ctx);
if (!ret &&
- btrfs_must_commit_transaction(trans, di_inode))
+ btrfs_must_commit_transaction(trans, BTRFS_I(di_inode)))
ret = 1;
iput(di_inode);
if (ret)
@@ -5361,7 +5361,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
ret = btrfs_log_inode(trans, root, dir_inode,
LOG_INODE_ALL, 0, LLONG_MAX, ctx);
if (!ret &&
- btrfs_must_commit_transaction(trans, dir_inode))
+ btrfs_must_commit_transaction(trans, BTRFS_I(dir_inode)))
ret = 1;
if (!ret && ctx && ctx->log_new_dentries)
ret = log_new_dir_dentries(trans, root,
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 02/24] btrfs: Make btrfs_record_unlink_dir take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
2017-01-12 14:00 ` [PATCH 01/24] btrfs: Make btrfs_must_commit_transaction take btrfs_inode Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 03/24] btrfs: Make btrfs_record_snapshot_destroy " Nikolay Borisov
` (22 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/inode.c | 8 ++++----
fs/btrfs/tree-log.c | 18 +++++++++---------
fs/btrfs/tree-log.h | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 80060aa2eda2..c8e73cf9306f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4142,7 +4142,7 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
if (IS_ERR(trans))
return PTR_ERR(trans);
- btrfs_record_unlink_dir(trans, dir, d_inode(dentry), 0);
+ btrfs_record_unlink_dir(trans, BTRFS_I(dir), BTRFS_I(d_inode(dentry)), 0);
ret = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
dentry->d_name.name, dentry->d_name.len);
@@ -9586,8 +9586,8 @@ static int btrfs_rename_exchange(struct inode *old_dir,
new_inode->i_ctime = ctime;
if (old_dentry->d_parent != new_dentry->d_parent) {
- btrfs_record_unlink_dir(trans, old_dir, old_inode, 1);
- btrfs_record_unlink_dir(trans, new_dir, new_inode, 1);
+ btrfs_record_unlink_dir(trans, BTRFS_I(old_dir), BTRFS_I(old_inode), 1);
+ btrfs_record_unlink_dir(trans, BTRFS_I(new_dir), BTRFS_I(new_inode), 1);
}
/* src is a subvolume */
@@ -9866,7 +9866,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
old_inode->i_ctime = current_time(old_dir);
if (old_dentry->d_parent != new_dentry->d_parent)
- btrfs_record_unlink_dir(trans, old_dir, old_inode, 1);
+ btrfs_record_unlink_dir(trans, BTRFS_I(old_dir), BTRFS_I(old_inode), 1);
if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) {
root_objectid = BTRFS_I(old_inode)->root->root_key.objectid;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index f6de921e28b0..0b1e2629ea48 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5723,7 +5723,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
* inodes, etc) are done.
*/
void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
int for_rename)
{
/*
@@ -5736,23 +5736,23 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
* into the file. When the file is logged we check it and
* don't log the parents if the file is fully on disk.
*/
- mutex_lock(&BTRFS_I(inode)->log_mutex);
- BTRFS_I(inode)->last_unlink_trans = trans->transid;
- mutex_unlock(&BTRFS_I(inode)->log_mutex);
+ mutex_lock(&inode->log_mutex);
+ inode->last_unlink_trans = trans->transid;
+ mutex_unlock(&inode->log_mutex);
/*
* if this directory was already logged any new
* names for this file/dir will get recorded
*/
smp_mb();
- if (BTRFS_I(dir)->logged_trans == trans->transid)
+ if (dir->logged_trans == trans->transid)
return;
/*
* if the inode we're about to unlink was logged,
* the log will be properly updated for any new names
*/
- if (BTRFS_I(inode)->logged_trans == trans->transid)
+ if (inode->logged_trans == trans->transid)
return;
/*
@@ -5769,9 +5769,9 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
return;
record:
- mutex_lock(&BTRFS_I(dir)->log_mutex);
- BTRFS_I(dir)->last_unlink_trans = trans->transid;
- mutex_unlock(&BTRFS_I(dir)->log_mutex);
+ mutex_lock(&dir->log_mutex);
+ dir->last_unlink_trans = trans->transid;
+ mutex_unlock(&dir->log_mutex);
}
/*
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index ab858e31ccbc..69702eef9603 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -80,7 +80,7 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
void btrfs_end_log_trans(struct btrfs_root *root);
int btrfs_pin_log_trans(struct btrfs_root *root);
void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
int for_rename);
void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
struct inode *dir);
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 03/24] btrfs: Make btrfs_record_snapshot_destroy take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
2017-01-12 14:00 ` [PATCH 01/24] btrfs: Make btrfs_must_commit_transaction take btrfs_inode Nikolay Borisov
2017-01-12 14:00 ` [PATCH 02/24] btrfs: Make btrfs_record_unlink_dir " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 04/24] btrfs: Make btrfs_inode_in_log " Nikolay Borisov
` (21 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/ioctl.c | 2 +-
fs/btrfs/tree-log.c | 8 ++++----
fs/btrfs/tree-log.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index e8e1f5f5f93a..7d1b5378de49 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2497,7 +2497,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
trans->block_rsv = &block_rsv;
trans->bytes_reserved = block_rsv.size;
- btrfs_record_snapshot_destroy(trans, dir);
+ btrfs_record_snapshot_destroy(trans, BTRFS_I(dir));
ret = btrfs_unlink_subvol(trans, root, dir,
dest->root_key.objectid,
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 0b1e2629ea48..db787d957b74 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5787,11 +5787,11 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
* parent root and tree of tree roots trees, etc) are done.
*/
void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
- struct inode *dir)
+ struct btrfs_inode *dir)
{
- mutex_lock(&BTRFS_I(dir)->log_mutex);
- BTRFS_I(dir)->last_unlink_trans = trans->transid;
- mutex_unlock(&BTRFS_I(dir)->log_mutex);
+ mutex_lock(&dir->log_mutex);
+ dir->last_unlink_trans = trans->transid;
+ mutex_unlock(&dir->log_mutex);
}
/*
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index 69702eef9603..e08ce78b2ad4 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -83,7 +83,7 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
struct btrfs_inode *dir, struct btrfs_inode *inode,
int for_rename);
void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
- struct inode *dir);
+ struct btrfs_inode *dir);
int btrfs_log_new_name(struct btrfs_trans_handle *trans,
struct inode *inode, struct inode *old_dir,
struct dentry *parent);
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 04/24] btrfs: Make btrfs_inode_in_log take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (2 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 03/24] btrfs: Make btrfs_record_snapshot_destroy " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 05/24] btrfs: Make btrfs_log_new_name " Nikolay Borisov
` (20 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/btrfs_inode.h | 16 +++++++---------
fs/btrfs/file.c | 2 +-
fs/btrfs/inode.c | 16 ++++++++--------
fs/btrfs/tree-log.c | 4 ++--
4 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 4fed080545c6..b2dde0efebc0 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -255,16 +255,14 @@ static inline bool btrfs_is_free_space_inode(struct inode *inode)
return false;
}
-static inline int btrfs_inode_in_log(struct inode *inode, u64 generation)
+static inline int btrfs_inode_in_log(struct btrfs_inode *inode, u64 generation)
{
int ret = 0;
- spin_lock(&BTRFS_I(inode)->lock);
- if (BTRFS_I(inode)->logged_trans == generation &&
- BTRFS_I(inode)->last_sub_trans <=
- BTRFS_I(inode)->last_log_commit &&
- BTRFS_I(inode)->last_sub_trans <=
- BTRFS_I(inode)->root->last_log_commit) {
+ spin_lock(&inode->lock);
+ if (inode->logged_trans == generation &&
+ inode->last_sub_trans <= inode->last_log_commit &&
+ inode->last_sub_trans <= inode->root->last_log_commit) {
/*
* After a ranged fsync we might have left some extent maps
* (that fall outside the fsync's range). So return false
@@ -272,10 +270,10 @@ static inline int btrfs_inode_in_log(struct inode *inode, u64 generation)
* will be called and process those extent maps.
*/
smp_mb();
- if (list_empty(&BTRFS_I(inode)->extent_tree.modified_extents))
+ if (list_empty(&inode->extent_tree.modified_extents))
ret = 1;
}
- spin_unlock(&BTRFS_I(inode)->lock);
+ spin_unlock(&inode->lock);
return ret;
}
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 0d32f45cef28..149b79b3aaf8 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2062,7 +2062,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
* commit does not start nor waits for ordered extents to complete.
*/
smp_mb();
- if (btrfs_inode_in_log(inode, fs_info->generation) ||
+ if (btrfs_inode_in_log(BTRFS_I(inode), fs_info->generation) ||
(full_sync && BTRFS_I(inode)->last_trans <=
fs_info->last_trans_committed) ||
(!btrfs_have_ordered_extents_in_range(inode, start, len) &&
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c8e73cf9306f..c2835d0b7098 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9676,11 +9676,11 @@ static int btrfs_rename_exchange(struct inode *old_dir,
* allow the tasks to sync it.
*/
if (ret && (root_log_pinned || dest_log_pinned)) {
- if (btrfs_inode_in_log(old_dir, fs_info->generation) ||
- btrfs_inode_in_log(new_dir, fs_info->generation) ||
- btrfs_inode_in_log(old_inode, fs_info->generation) ||
+ if (btrfs_inode_in_log(BTRFS_I(old_dir), fs_info->generation) ||
+ btrfs_inode_in_log(BTRFS_I(new_dir), fs_info->generation) ||
+ btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) ||
(new_inode &&
- btrfs_inode_in_log(new_inode, fs_info->generation)))
+ btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation)))
btrfs_set_log_full_commit(fs_info, trans);
if (root_log_pinned) {
@@ -9952,11 +9952,11 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
* allow the tasks to sync it.
*/
if (ret && log_pinned) {
- if (btrfs_inode_in_log(old_dir, fs_info->generation) ||
- btrfs_inode_in_log(new_dir, fs_info->generation) ||
- btrfs_inode_in_log(old_inode, fs_info->generation) ||
+ if (btrfs_inode_in_log(BTRFS_I(old_dir), fs_info->generation) ||
+ btrfs_inode_in_log(BTRFS_I(new_dir), fs_info->generation) ||
+ btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) ||
(new_inode &&
- btrfs_inode_in_log(new_inode, fs_info->generation)))
+ btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation)))
btrfs_set_log_full_commit(fs_info, trans);
btrfs_end_log_trans(root);
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index db787d957b74..806e0ffc9150 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5230,7 +5230,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
goto next_dir_inode;
}
- if (btrfs_inode_in_log(di_inode, trans->transid)) {
+ if (btrfs_inode_in_log(BTRFS_I(di_inode), trans->transid)) {
iput(di_inode);
break;
}
@@ -5429,7 +5429,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
if (ret)
goto end_no_trans;
- if (btrfs_inode_in_log(inode, trans->transid)) {
+ if (btrfs_inode_in_log(BTRFS_I(inode), trans->transid)) {
ret = BTRFS_NO_LOG_SYNC;
goto end_no_trans;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 05/24] btrfs: Make btrfs_log_new_name take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (3 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 04/24] btrfs: Make btrfs_inode_in_log " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 06/24] btrfs: Make btrfs_del_dir_entries_in_log " Nikolay Borisov
` (19 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/inode.c | 8 ++++----
fs/btrfs/tree-log.c | 18 ++++++++----------
fs/btrfs/tree-log.h | 2 +-
3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c2835d0b7098..131669ca1f07 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6600,7 +6600,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
goto fail;
}
d_instantiate(dentry, inode);
- btrfs_log_new_name(trans, inode, NULL, parent);
+ btrfs_log_new_name(trans, BTRFS_I(inode), NULL, parent);
}
btrfs_balance_delayed_items(fs_info);
@@ -9653,13 +9653,13 @@ static int btrfs_rename_exchange(struct inode *old_dir,
if (root_log_pinned) {
parent = new_dentry->d_parent;
- btrfs_log_new_name(trans, old_inode, old_dir, parent);
+ btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), parent);
btrfs_end_log_trans(root);
root_log_pinned = false;
}
if (dest_log_pinned) {
parent = old_dentry->d_parent;
- btrfs_log_new_name(trans, new_inode, new_dir, parent);
+ btrfs_log_new_name(trans, BTRFS_I(new_inode), BTRFS_I(new_dir), parent);
btrfs_end_log_trans(dest);
dest_log_pinned = false;
}
@@ -9925,7 +9925,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (log_pinned) {
struct dentry *parent = new_dentry->d_parent;
- btrfs_log_new_name(trans, old_inode, old_dir, parent);
+ btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), parent);
btrfs_end_log_trans(root);
log_pinned = false;
}
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 806e0ffc9150..f37194700f3a 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5802,30 +5802,28 @@ void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
* full transaction commit is required.
*/
int btrfs_log_new_name(struct btrfs_trans_handle *trans,
- struct inode *inode, struct inode *old_dir,
+ struct btrfs_inode *inode, struct btrfs_inode *old_dir,
struct dentry *parent)
{
- struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
- struct btrfs_root * root = BTRFS_I(inode)->root;
+ struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+ struct btrfs_root * root = inode->root;
/*
* this will force the logging code to walk the dentry chain
* up for the file
*/
- if (S_ISREG(inode->i_mode))
- BTRFS_I(inode)->last_unlink_trans = trans->transid;
+ if (S_ISREG(inode->vfs_inode.i_mode))
+ inode->last_unlink_trans = trans->transid;
/*
* if this inode hasn't been logged and directory we're renaming it
* from hasn't been logged, we don't need to log it
*/
- if (BTRFS_I(inode)->logged_trans <=
- fs_info->last_trans_committed &&
- (!old_dir || BTRFS_I(old_dir)->logged_trans <=
- fs_info->last_trans_committed))
+ if (inode->logged_trans <= fs_info->last_trans_committed &&
+ (!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed))
return 0;
- return btrfs_log_inode_parent(trans, root, inode, parent, 0,
+ return btrfs_log_inode_parent(trans, root, &inode->vfs_inode, parent, 0,
LLONG_MAX, 1, NULL);
}
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index e08ce78b2ad4..2bcbac7efa9c 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -85,6 +85,6 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
struct btrfs_inode *dir);
int btrfs_log_new_name(struct btrfs_trans_handle *trans,
- struct inode *inode, struct inode *old_dir,
+ struct btrfs_inode *inode, struct btrfs_inode *old_dir,
struct dentry *parent);
#endif
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 06/24] btrfs: Make btrfs_del_dir_entries_in_log take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (4 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 05/24] btrfs: Make btrfs_log_new_name " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 07/24] btrfs: Make btrfs_del_inode_ref " Nikolay Borisov
` (18 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/inode.c | 2 +-
fs/btrfs/tree-log.c | 10 +++++-----
fs/btrfs/tree-log.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 131669ca1f07..7d441931fc1e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4075,7 +4075,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
}
ret = btrfs_del_dir_entries_in_log(trans, root, name, name_len,
- dir, index);
+ BTRFS_I(dir), index);
if (ret == -ENOENT)
ret = 0;
else if (ret)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index f37194700f3a..904f12b5ec72 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3083,7 +3083,7 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans,
int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
- struct inode *dir, u64 index)
+ struct btrfs_inode *dir, u64 index)
{
struct btrfs_root *log;
struct btrfs_dir_item *di;
@@ -3091,16 +3091,16 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
int ret;
int err = 0;
int bytes_del = 0;
- u64 dir_ino = btrfs_ino(BTRFS_I(dir));
+ u64 dir_ino = btrfs_ino(dir);
- if (BTRFS_I(dir)->logged_trans < trans->transid)
+ if (dir->logged_trans < trans->transid)
return 0;
ret = join_running_log_trans(root);
if (ret)
return 0;
- mutex_lock(&BTRFS_I(dir)->log_mutex);
+ mutex_lock(&dir->log_mutex);
log = root->log_root;
path = btrfs_alloc_path();
@@ -3175,7 +3175,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
fail:
btrfs_free_path(path);
out_unlock:
- mutex_unlock(&BTRFS_I(dir)->log_mutex);
+ mutex_unlock(&dir->log_mutex);
if (ret == -ENOSPC) {
btrfs_set_log_full_commit(root->fs_info, trans);
ret = 0;
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index 2bcbac7efa9c..6c2b316b28e0 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -72,7 +72,7 @@ int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans,
int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
- struct inode *dir, u64 index);
+ struct btrfs_inode *dir, u64 index);
int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 07/24] btrfs: Make btrfs_del_inode_ref take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (5 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 06/24] btrfs: Make btrfs_del_dir_entries_in_log " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 08/24] btrfs: Make logged_inode_size " Nikolay Borisov
` (17 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/inode.c | 2 +-
fs/btrfs/tree-log.c | 10 +++++-----
fs/btrfs/tree-log.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7d441931fc1e..9693f83cfc4b 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4068,7 +4068,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
}
ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len,
- inode, dir_ino);
+ BTRFS_I(inode), dir_ino);
if (ret != 0 && ret != -ENOENT) {
btrfs_abort_transaction(trans, ret);
goto err;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 904f12b5ec72..ffe9aad04be5 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3191,25 +3191,25 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
- struct inode *inode, u64 dirid)
+ struct btrfs_inode *inode, u64 dirid)
{
struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_root *log;
u64 index;
int ret;
- if (BTRFS_I(inode)->logged_trans < trans->transid)
+ if (inode->logged_trans < trans->transid)
return 0;
ret = join_running_log_trans(root);
if (ret)
return 0;
log = root->log_root;
- mutex_lock(&BTRFS_I(inode)->log_mutex);
+ mutex_lock(&inode->log_mutex);
- ret = btrfs_del_inode_ref(trans, log, name, name_len, btrfs_ino(BTRFS_I(inode)),
+ ret = btrfs_del_inode_ref(trans, log, name, name_len, btrfs_ino(inode),
dirid, &index);
- mutex_unlock(&BTRFS_I(inode)->log_mutex);
+ mutex_unlock(&inode->log_mutex);
if (ret == -ENOSPC) {
btrfs_set_log_full_commit(fs_info, trans);
ret = 0;
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index 6c2b316b28e0..bc50f128c6be 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -76,7 +76,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
- struct inode *inode, u64 dirid);
+ struct btrfs_inode *inode, u64 dirid);
void btrfs_end_log_trans(struct btrfs_root *root);
int btrfs_pin_log_trans(struct btrfs_root *root);
void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 08/24] btrfs: Make logged_inode_size take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (6 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 07/24] btrfs: Make btrfs_del_inode_ref " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 09/24] btrfs: Make btrfs_check_ref_name_override " Nikolay Borisov
` (16 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index ffe9aad04be5..0fc963454c82 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4240,13 +4240,13 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
return ret;
}
-static int logged_inode_size(struct btrfs_root *log, struct inode *inode,
+static int logged_inode_size(struct btrfs_root *log, struct btrfs_inode *inode,
struct btrfs_path *path, u64 *size_ret)
{
struct btrfs_key key;
int ret;
- key.objectid = btrfs_ino(BTRFS_I(inode));
+ key.objectid = btrfs_ino(inode);
key.type = BTRFS_INODE_ITEM_KEY;
key.offset = 0;
@@ -4692,7 +4692,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* (zeroes), as if an expanding truncate happened,
* instead of getting a file of 4Kb only.
*/
- err = logged_inode_size(log, inode, path,
+ err = logged_inode_size(log, BTRFS_I(inode), path,
&logged_isize);
if (err)
goto out_unlock;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 09/24] btrfs: Make btrfs_check_ref_name_override take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (7 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 08/24] btrfs: Make logged_inode_size " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 10/24] btrfs: Make copy_items " Nikolay Borisov
` (15 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 0fc963454c82..2b44835b4dea 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4494,7 +4494,7 @@ static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans,
static int btrfs_check_ref_name_override(struct extent_buffer *eb,
const int slot,
const struct btrfs_key *key,
- struct inode *inode,
+ struct btrfs_inode *inode,
u64 *other_ino)
{
int ret;
@@ -4550,9 +4550,8 @@ static int btrfs_check_ref_name_override(struct extent_buffer *eb,
}
read_extent_buffer(eb, name, name_ptr, this_name_len);
- di = btrfs_lookup_dir_item(NULL, BTRFS_I(inode)->root,
- search_path, parent,
- name, this_name_len, 0);
+ di = btrfs_lookup_dir_item(NULL, inode->root, search_path,
+ parent, name, this_name_len, 0);
if (di && !IS_ERR(di)) {
struct btrfs_key di_key;
@@ -4762,7 +4761,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
ret = btrfs_check_ref_name_override(path->nodes[0],
path->slots[0],
- &min_key, inode,
+ &min_key, BTRFS_I(inode),
&other_ino);
if (ret < 0) {
err = ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 10/24] btrfs: Make copy_items take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (8 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 09/24] btrfs: Make btrfs_check_ref_name_override " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 11/24] btrfs: Make btrfs_log_all_xattrs " Nikolay Borisov
` (14 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 40 +++++++++++++++++++---------------------
1 file changed, 19 insertions(+), 21 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 2b44835b4dea..4b0bbe05cdae 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3612,16 +3612,16 @@ static int log_inode_item(struct btrfs_trans_handle *trans,
}
static noinline int copy_items(struct btrfs_trans_handle *trans,
- struct inode *inode,
+ struct btrfs_inode *inode,
struct btrfs_path *dst_path,
struct btrfs_path *src_path, u64 *last_extent,
int start_slot, int nr, int inode_only,
u64 logged_isize)
{
- struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+ struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
unsigned long src_offset;
unsigned long dst_offset;
- struct btrfs_root *log = BTRFS_I(inode)->root->log_root;
+ struct btrfs_root *log = inode->root->log_root;
struct btrfs_file_extent_item *extent;
struct btrfs_inode_item *inode_item;
struct extent_buffer *src = src_path->nodes[0];
@@ -3632,7 +3632,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
char *ins_data;
int i;
struct list_head ordered_sums;
- int skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
+ int skip_csum = inode->flags & BTRFS_INODE_NODATASUM;
bool has_extents = false;
bool need_find_last_extent = true;
bool done = false;
@@ -3674,7 +3674,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
dst_path->slots[0],
struct btrfs_inode_item);
fill_inode_item(trans, dst_path->nodes[0], inode_item,
- inode, inode_only == LOG_INODE_EXISTS,
+ &inode->vfs_inode, inode_only == LOG_INODE_EXISTS,
logged_isize);
} else {
copy_extent_buffer(dst_path->nodes[0], src, dst_offset,
@@ -3782,7 +3782,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
if (need_find_last_extent) {
u64 len;
- ret = btrfs_prev_leaf(BTRFS_I(inode)->root, src_path);
+ ret = btrfs_prev_leaf(inode->root, src_path);
if (ret < 0)
return ret;
if (ret)
@@ -3791,7 +3791,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
src_path->slots[0]--;
src = src_path->nodes[0];
btrfs_item_key_to_cpu(src, &key, src_path->slots[0]);
- if (key.objectid != btrfs_ino(BTRFS_I(inode)) ||
+ if (key.objectid != btrfs_ino(inode) ||
key.type != BTRFS_EXTENT_DATA_KEY)
goto fill_holes;
extent = btrfs_item_ptr(src, src_path->slots[0],
@@ -3824,8 +3824,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
if (need_find_last_extent) {
/* btrfs_prev_leaf could return 1 without releasing the path */
btrfs_release_path(src_path);
- ret = btrfs_search_slot(NULL, BTRFS_I(inode)->root, &first_key,
- src_path, 0, 0);
+ ret = btrfs_search_slot(NULL, inode->root, &first_key, src_path, 0, 0);
if (ret < 0)
return ret;
ASSERT(ret == 0);
@@ -3845,7 +3844,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
u64 extent_end;
if (i >= btrfs_header_nritems(src_path->nodes[0])) {
- ret = btrfs_next_leaf(BTRFS_I(inode)->root, src_path);
+ ret = btrfs_next_leaf(inode->root, src_path);
if (ret < 0)
return ret;
ASSERT(ret == 0);
@@ -3856,7 +3855,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
btrfs_item_key_to_cpu(src, &key, i);
if (!btrfs_comp_cpu_keys(&key, &last_key))
done = true;
- if (key.objectid != btrfs_ino(BTRFS_I(inode)) ||
+ if (key.objectid != btrfs_ino(inode) ||
key.type != BTRFS_EXTENT_DATA_KEY) {
i++;
continue;
@@ -3879,9 +3878,8 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
}
offset = *last_extent;
len = key.offset - *last_extent;
- ret = btrfs_insert_file_extent(trans, log, btrfs_ino(BTRFS_I(inode)),
- offset, 0, 0, len, 0, len, 0,
- 0, 0);
+ ret = btrfs_insert_file_extent(trans, log, btrfs_ino(inode),
+ offset, 0, 0, len, 0, len, 0, 0, 0);
if (ret)
break;
*last_extent = extent_end;
@@ -4305,7 +4303,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
if (ins_nr > 0) {
u64 last_extent = 0;
- ret = copy_items(trans, inode, dst_path, path,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
&last_extent, start_slot,
ins_nr, 1, 0);
/* can't be 1, extent items aren't processed */
@@ -4335,7 +4333,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
if (ins_nr > 0) {
u64 last_extent = 0;
- ret = copy_items(trans, inode, dst_path, path,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
&last_extent, start_slot,
ins_nr, 1, 0);
/* can't be 1, extent items aren't processed */
@@ -4777,7 +4775,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
ins_nr = 1;
ins_start_slot = path->slots[0];
}
- ret = copy_items(trans, inode, dst_path, path,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only,
logged_isize);
@@ -4830,7 +4828,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
if (min_key.type == BTRFS_XATTR_ITEM_KEY) {
if (ins_nr == 0)
goto next_slot;
- ret = copy_items(trans, inode, dst_path, path,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only, logged_isize);
if (ret < 0) {
@@ -4855,7 +4853,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto next_slot;
}
- ret = copy_items(trans, inode, dst_path, path, &last_extent,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent,
ins_start_slot, ins_nr, inode_only,
logged_isize);
if (ret < 0) {
@@ -4879,7 +4877,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto again;
}
if (ins_nr) {
- ret = copy_items(trans, inode, dst_path, path,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only, logged_isize);
if (ret < 0) {
@@ -4901,7 +4899,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
}
}
if (ins_nr) {
- ret = copy_items(trans, inode, dst_path, path, &last_extent,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent,
ins_start_slot, ins_nr, inode_only,
logged_isize);
if (ret < 0) {
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 11/24] btrfs: Make btrfs_log_all_xattrs take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (9 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 10/24] btrfs: Make copy_items " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 12/24] btrfs: Make btrfs_log_trailing_hole " Nikolay Borisov
` (13 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 4b0bbe05cdae..4d8726aad7b3 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4276,13 +4276,13 @@ static int logged_inode_size(struct btrfs_root *log, struct btrfs_inode *inode,
*/
static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *inode,
+ struct btrfs_inode *inode,
struct btrfs_path *path,
struct btrfs_path *dst_path)
{
int ret;
struct btrfs_key key;
- const u64 ino = btrfs_ino(BTRFS_I(inode));
+ const u64 ino = btrfs_ino(inode);
int ins_nr = 0;
int start_slot = 0;
@@ -4303,7 +4303,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
if (ins_nr > 0) {
u64 last_extent = 0;
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
+ ret = copy_items(trans, inode, dst_path, path,
&last_extent, start_slot,
ins_nr, 1, 0);
/* can't be 1, extent items aren't processed */
@@ -4333,7 +4333,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
if (ins_nr > 0) {
u64 last_extent = 0;
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
+ ret = copy_items(trans, inode, dst_path, path,
&last_extent, start_slot,
ins_nr, 1, 0);
/* can't be 1, extent items aren't processed */
@@ -4912,7 +4912,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
btrfs_release_path(dst_path);
- err = btrfs_log_all_xattrs(trans, root, inode, path, dst_path);
+ err = btrfs_log_all_xattrs(trans, root, BTRFS_I(inode), path, dst_path);
if (err)
goto out_unlock;
if (max_key.type >= BTRFS_EXTENT_DATA_KEY && !fast_search) {
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 12/24] btrfs: Make btrfs_log_trailing_hole take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (10 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 11/24] btrfs: Make btrfs_log_all_xattrs " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 13/24] btrfs: Make btrfs_get_logged_extents " Nikolay Borisov
` (12 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 4d8726aad7b3..98b40e65d880 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4371,7 +4371,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
*/
static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *inode,
+ struct btrfs_inode *inode,
struct btrfs_path *path)
{
struct btrfs_fs_info *fs_info = root->fs_info;
@@ -4381,8 +4381,8 @@ static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans,
u64 hole_size;
struct extent_buffer *leaf;
struct btrfs_root *log = root->log_root;
- const u64 ino = btrfs_ino(BTRFS_I(inode));
- const u64 i_size = i_size_read(inode);
+ const u64 ino = btrfs_ino(inode);
+ const u64 i_size = i_size_read(&inode->vfs_inode);
if (!btrfs_fs_incompat(fs_info, NO_HOLES))
return 0;
@@ -4918,7 +4918,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
if (max_key.type >= BTRFS_EXTENT_DATA_KEY && !fast_search) {
btrfs_release_path(path);
btrfs_release_path(dst_path);
- err = btrfs_log_trailing_hole(trans, root, inode, path);
+ err = btrfs_log_trailing_hole(trans, root, BTRFS_I(inode), path);
if (err)
goto out_unlock;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 13/24] btrfs: Make btrfs_get_logged_extents take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (11 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 12/24] btrfs: Make btrfs_log_trailing_hole " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 14/24] btrfs: Make btrfs_log_changed_extents " Nikolay Borisov
` (11 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/ordered-data.c | 4 ++--
fs/btrfs/ordered-data.h | 2 +-
fs/btrfs/tree-log.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 041c3326d109..7ae350a64c77 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -432,7 +432,7 @@ int btrfs_dec_test_ordered_pending(struct inode *inode,
}
/* Needs to either be called under a log transaction or the log_mutex */
-void btrfs_get_logged_extents(struct inode *inode,
+void btrfs_get_logged_extents(struct btrfs_inode *inode,
struct list_head *logged_list,
const loff_t start,
const loff_t end)
@@ -442,7 +442,7 @@ void btrfs_get_logged_extents(struct inode *inode,
struct rb_node *n;
struct rb_node *prev;
- tree = &BTRFS_I(inode)->ordered_tree;
+ tree = &inode->ordered_tree;
spin_lock_irq(&tree->lock);
n = __tree_search(&tree->tree, end, &prev);
if (!n)
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index 5f2b0ca28705..b02b71d41d83 100644
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -201,7 +201,7 @@ int btrfs_wait_ordered_extents(struct btrfs_root *root, int nr,
const u64 range_start, const u64 range_len);
int btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, int nr,
const u64 range_start, const u64 range_len);
-void btrfs_get_logged_extents(struct inode *inode,
+void btrfs_get_logged_extents(struct btrfs_inode *inode,
struct list_head *logged_list,
const loff_t start,
const loff_t end);
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 98b40e65d880..657c118aed63 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4192,7 +4192,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
}
list_sort(NULL, &extents, extent_cmp);
- btrfs_get_logged_extents(inode, logged_list, start, end);
+ btrfs_get_logged_extents(BTRFS_I(inode), logged_list, start, end);
/*
* Some ordered extents started by fsync might have completed
* before we could collect them into the list logged_list, which
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 14/24] btrfs: Make btrfs_log_changed_extents take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (12 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 13/24] btrfs: Make btrfs_get_logged_extents " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 15/24] btrfs: Make log_dir_items " Nikolay Borisov
` (10 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 657c118aed63..5abe54963049 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4052,7 +4052,7 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans,
}
static int log_one_extent(struct btrfs_trans_handle *trans,
- struct inode *inode, struct btrfs_root *root,
+ struct btrfs_inode *inode, struct btrfs_root *root,
const struct extent_map *em,
struct btrfs_path *path,
const struct list_head *logged_list,
@@ -4069,7 +4069,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
int extent_inserted = 0;
bool ordered_io_err = false;
- ret = wait_ordered_extents(trans, inode, root, em, logged_list,
+ ret = wait_ordered_extents(trans, &inode->vfs_inode, root, em, logged_list,
&ordered_io_err);
if (ret)
return ret;
@@ -4081,14 +4081,14 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
btrfs_init_map_token(&token);
- ret = __btrfs_drop_extents(trans, log, inode, path, em->start,
+ ret = __btrfs_drop_extents(trans, log, &inode->vfs_inode, path, em->start,
em->start + em->len, NULL, 0, 1,
sizeof(*fi), &extent_inserted);
if (ret)
return ret;
if (!extent_inserted) {
- key.objectid = btrfs_ino(BTRFS_I(inode));
+ key.objectid = btrfs_ino(inode);
key.type = BTRFS_EXTENT_DATA_KEY;
key.offset = em->start;
@@ -4147,7 +4147,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *inode,
+ struct btrfs_inode *inode,
struct btrfs_path *path,
struct list_head *logged_list,
struct btrfs_log_ctx *ctx,
@@ -4156,14 +4156,14 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
{
struct extent_map *em, *n;
struct list_head extents;
- struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree;
+ struct extent_map_tree *tree = &inode->extent_tree;
u64 test_gen;
int ret = 0;
int num = 0;
INIT_LIST_HEAD(&extents);
- down_write(&BTRFS_I(inode)->dio_sem);
+ down_write(&inode->dio_sem);
write_lock(&tree->lock);
test_gen = root->fs_info->last_trans_committed;
@@ -4192,7 +4192,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
}
list_sort(NULL, &extents, extent_cmp);
- btrfs_get_logged_extents(BTRFS_I(inode), logged_list, start, end);
+ btrfs_get_logged_extents(inode, logged_list, start, end);
/*
* Some ordered extents started by fsync might have completed
* before we could collect them into the list logged_list, which
@@ -4203,7 +4203,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
* without writing to the log tree and the fsync must report the
* file data write error and not commit the current transaction.
*/
- ret = filemap_check_errors(inode->i_mapping);
+ ret = filemap_check_errors(inode->vfs_inode.i_mapping);
if (ret)
ctx->io_err = ret;
process:
@@ -4232,7 +4232,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
}
WARN_ON(!list_empty(&extents));
write_unlock(&tree->lock);
- up_write(&BTRFS_I(inode)->dio_sem);
+ up_write(&inode->dio_sem);
btrfs_release_path(path);
return ret;
@@ -4931,7 +4931,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto out_unlock;
}
if (fast_search) {
- ret = btrfs_log_changed_extents(trans, root, inode, dst_path,
+ ret = btrfs_log_changed_extents(trans, root, BTRFS_I(inode), dst_path,
&logged_list, ctx, start, end);
if (ret) {
err = ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 15/24] btrfs: Make log_dir_items take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (13 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 14/24] btrfs: Make btrfs_log_changed_extents " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 16/24] btrfs: Make log_directory_changes " Nikolay Borisov
` (9 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 5abe54963049..84c1ab4c8a7f 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3259,7 +3259,7 @@ static noinline int insert_dir_log_key(struct btrfs_trans_handle *trans,
* to replay anything deleted before the fsync
*/
static noinline int log_dir_items(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct inode *inode,
+ struct btrfs_root *root, struct btrfs_inode *inode,
struct btrfs_path *path,
struct btrfs_path *dst_path, int key_type,
struct btrfs_log_ctx *ctx,
@@ -3274,7 +3274,7 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans,
int nritems;
u64 first_offset = min_offset;
u64 last_offset = (u64)-1;
- u64 ino = btrfs_ino(BTRFS_I(inode));
+ u64 ino = btrfs_ino(inode);
log = root->log_root;
@@ -3463,7 +3463,7 @@ static noinline int log_directory_changes(struct btrfs_trans_handle *trans,
min_key = 0;
max_key = 0;
while (1) {
- ret = log_dir_items(trans, root, inode, path,
+ ret = log_dir_items(trans, root, BTRFS_I(inode), path,
dst_path, key_type, ctx, min_key,
&max_key);
if (ret)
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 16/24] btrfs: Make log_directory_changes take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (14 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 15/24] btrfs: Make log_dir_items " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 17/24] btrfs: Make log_new_dir_dentries " Nikolay Borisov
` (8 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 84c1ab4c8a7f..7a500ff14681 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3449,7 +3449,7 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans,
* key logged by this transaction.
*/
static noinline int log_directory_changes(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct inode *inode,
+ struct btrfs_root *root, struct btrfs_inode *inode,
struct btrfs_path *path,
struct btrfs_path *dst_path,
struct btrfs_log_ctx *ctx)
@@ -3463,9 +3463,8 @@ static noinline int log_directory_changes(struct btrfs_trans_handle *trans,
min_key = 0;
max_key = 0;
while (1) {
- ret = log_dir_items(trans, root, BTRFS_I(inode), path,
- dst_path, key_type, ctx, min_key,
- &max_key);
+ ret = log_dir_items(trans, root, inode, path, dst_path, key_type,
+ ctx, min_key, &max_key);
if (ret)
return ret;
if (max_key == (u64)-1)
@@ -4970,7 +4969,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
}
if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
- ret = log_directory_changes(trans, root, inode, path, dst_path,
+ ret = log_directory_changes(trans, root, BTRFS_I(inode), path, dst_path,
ctx);
if (ret) {
err = ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 17/24] btrfs: Make log_new_dir_dentries take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (15 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 16/24] btrfs: Make log_directory_changes " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 18/24] btrfs: Make btrfs_unlink_inode " Nikolay Borisov
` (7 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 7a500ff14681..94f2e1c705b2 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5148,7 +5148,7 @@ struct btrfs_dir_list {
*/
static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *start_inode,
+ struct btrfs_inode *start_inode,
struct btrfs_log_ctx *ctx)
{
struct btrfs_fs_info *fs_info = root->fs_info;
@@ -5167,7 +5167,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
btrfs_free_path(path);
return -ENOMEM;
}
- dir_elem->ino = btrfs_ino(BTRFS_I(start_inode));
+ dir_elem->ino = btrfs_ino(start_inode);
list_add_tail(&dir_elem->list, &dir_list);
while (!list_empty(&dir_list)) {
@@ -5361,7 +5361,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
ret = 1;
if (!ret && ctx && ctx->log_new_dentries)
ret = log_new_dir_dentries(trans, root,
- dir_inode, ctx);
+ BTRFS_I(dir_inode), ctx);
iput(dir_inode);
if (ret)
goto out;
@@ -5524,7 +5524,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
old_parent = parent;
}
if (log_dentries)
- ret = log_new_dir_dentries(trans, root, orig_inode, ctx);
+ ret = log_new_dir_dentries(trans, root, BTRFS_I(orig_inode), ctx);
else
ret = 0;
end_trans:
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 18/24] btrfs: Make btrfs_unlink_inode take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (16 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 17/24] btrfs: Make log_new_dir_dentries " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 19/24] btrfs: Make drop_one_dir_item " Nikolay Borisov
` (6 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/ctree.h | 2 +-
fs/btrfs/inode.c | 58 ++++++++++++++++++++++++++---------------------------
fs/btrfs/tree-log.c | 14 ++++++-------
3 files changed, 36 insertions(+), 38 deletions(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 6a823719b6c5..06d5e6388b4c 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3119,7 +3119,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry);
int btrfs_set_inode_index(struct inode *dir, u64 *index);
int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
const char *name, int name_len);
int btrfs_add_link(struct btrfs_trans_handle *trans,
struct inode *parent_inode, struct inode *inode,
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9693f83cfc4b..fd1f34e86580 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3996,7 +3996,7 @@ noinline int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,
*/
static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
const char *name, int name_len)
{
struct btrfs_fs_info *fs_info = root->fs_info;
@@ -4006,8 +4006,8 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
struct btrfs_dir_item *di;
struct btrfs_key key;
u64 index;
- u64 ino = btrfs_ino(BTRFS_I(inode));
- u64 dir_ino = btrfs_ino(BTRFS_I(dir));
+ u64 ino = btrfs_ino(inode);
+ u64 dir_ino = btrfs_ino(dir);
path = btrfs_alloc_path();
if (!path) {
@@ -4043,10 +4043,10 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
* that we delay to delete it, and just do this deletion when
* we update the inode item.
*/
- if (BTRFS_I(inode)->dir_index) {
- ret = btrfs_delayed_delete_inode_ref(BTRFS_I(inode));
+ if (inode->dir_index) {
+ ret = btrfs_delayed_delete_inode_ref(inode);
if (!ret) {
- index = BTRFS_I(inode)->dir_index;
+ index = inode->dir_index;
goto skip_backref;
}
}
@@ -4061,21 +4061,19 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
goto err;
}
skip_backref:
- ret = btrfs_delete_delayed_dir_index(trans, fs_info, BTRFS_I(dir), index);
+ ret = btrfs_delete_delayed_dir_index(trans, fs_info, dir, index);
if (ret) {
btrfs_abort_transaction(trans, ret);
goto err;
}
- ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len,
- BTRFS_I(inode), dir_ino);
+ ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len, inode, dir_ino);
if (ret != 0 && ret != -ENOENT) {
btrfs_abort_transaction(trans, ret);
goto err;
}
- ret = btrfs_del_dir_entries_in_log(trans, root, name, name_len,
- BTRFS_I(dir), index);
+ ret = btrfs_del_dir_entries_in_log(trans, root, name, name_len, dir, index);
if (ret == -ENOENT)
ret = 0;
else if (ret)
@@ -4085,26 +4083,26 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
if (ret)
goto out;
- btrfs_i_size_write(dir, dir->i_size - name_len * 2);
- inode_inc_iversion(inode);
- inode_inc_iversion(dir);
- inode->i_ctime = dir->i_mtime =
- dir->i_ctime = current_time(inode);
- ret = btrfs_update_inode(trans, root, dir);
+ btrfs_i_size_write(&dir->vfs_inode, dir->vfs_inode.i_size - name_len * 2);
+ inode_inc_iversion(&inode->vfs_inode);
+ inode_inc_iversion(&dir->vfs_inode);
+ inode->vfs_inode.i_ctime = dir->vfs_inode.i_mtime =
+ dir->vfs_inode.i_ctime = current_time(&inode->vfs_inode);
+ ret = btrfs_update_inode(trans, root, &dir->vfs_inode);
out:
return ret;
}
int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
const char *name, int name_len)
{
int ret;
ret = __btrfs_unlink_inode(trans, root, dir, inode, name, name_len);
if (!ret) {
- drop_nlink(inode);
- ret = btrfs_update_inode(trans, root, inode);
+ drop_nlink(&inode->vfs_inode);
+ ret = btrfs_update_inode(trans, root, &inode->vfs_inode);
}
return ret;
}
@@ -4144,7 +4142,7 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
btrfs_record_unlink_dir(trans, BTRFS_I(dir), BTRFS_I(d_inode(dentry)), 0);
- ret = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
+ ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir), BTRFS_I(d_inode(dentry)),
dentry->d_name.name, dentry->d_name.len);
if (ret)
goto out;
@@ -4274,7 +4272,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
last_unlink_trans = BTRFS_I(inode)->last_unlink_trans;
/* now the directory is empty */
- err = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
+ err = btrfs_unlink_inode(trans, root, BTRFS_I(dir), BTRFS_I(d_inode(dentry)),
dentry->d_name.name, dentry->d_name.len);
if (!err) {
btrfs_i_size_write(inode, 0);
@@ -9598,8 +9596,8 @@ static int btrfs_rename_exchange(struct inode *old_dir,
old_dentry->d_name.name,
old_dentry->d_name.len);
} else { /* src is an inode */
- ret = __btrfs_unlink_inode(trans, root, old_dir,
- old_dentry->d_inode,
+ ret = __btrfs_unlink_inode(trans, root, BTRFS_I(old_dir),
+ BTRFS_I(old_dentry->d_inode),
old_dentry->d_name.name,
old_dentry->d_name.len);
if (!ret)
@@ -9618,8 +9616,8 @@ static int btrfs_rename_exchange(struct inode *old_dir,
new_dentry->d_name.name,
new_dentry->d_name.len);
} else { /* dest is an inode */
- ret = __btrfs_unlink_inode(trans, dest, new_dir,
- new_dentry->d_inode,
+ ret = __btrfs_unlink_inode(trans, dest, BTRFS_I(new_dir),
+ BTRFS_I(new_dentry->d_inode),
new_dentry->d_name.name,
new_dentry->d_name.len);
if (!ret)
@@ -9874,8 +9872,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
old_dentry->d_name.name,
old_dentry->d_name.len);
} else {
- ret = __btrfs_unlink_inode(trans, root, old_dir,
- d_inode(old_dentry),
+ ret = __btrfs_unlink_inode(trans, root, BTRFS_I(old_dir),
+ BTRFS_I(d_inode(old_dentry)),
old_dentry->d_name.name,
old_dentry->d_name.len);
if (!ret)
@@ -9898,8 +9896,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
new_dentry->d_name.len);
BUG_ON(new_inode->i_nlink == 0);
} else {
- ret = btrfs_unlink_inode(trans, dest, new_dir,
- d_inode(new_dentry),
+ ret = btrfs_unlink_inode(trans, dest, BTRFS_I(new_dir),
+ BTRFS_I(d_inode(new_dentry)),
new_dentry->d_name.name,
new_dentry->d_name.len);
}
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 94f2e1c705b2..73a7e7b5aadc 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -874,7 +874,7 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
if (ret)
goto out;
- ret = btrfs_unlink_inode(trans, root, dir, inode, name, name_len);
+ ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir), BTRFS_I(inode), name, name_len);
if (ret)
goto out;
else
@@ -1049,8 +1049,8 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
inc_nlink(inode);
btrfs_release_path(path);
- ret = btrfs_unlink_inode(trans, root, dir,
- inode, victim_name,
+ ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir),
+ BTRFS_I(inode), victim_name,
victim_name_len);
kfree(victim_name);
if (ret)
@@ -1120,8 +1120,8 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
ret = btrfs_unlink_inode(trans, root,
- victim_parent,
- inode,
+ BTRFS_I(victim_parent),
+ BTRFS_I(inode),
victim_name,
victim_name_len);
if (!ret)
@@ -2051,8 +2051,8 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
}
inc_nlink(inode);
- ret = btrfs_unlink_inode(trans, root, dir, inode,
- name, name_len);
+ ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir),
+ BTRFS_I(inode), name, name_len);
if (!ret)
ret = btrfs_run_delayed_items(trans, fs_info);
kfree(name);
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 19/24] btrfs: Make drop_one_dir_item take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (17 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 18/24] btrfs: Make btrfs_unlink_inode " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 20/24] btrfs: Make __add_inode_ref " Nikolay Borisov
` (5 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 73a7e7b5aadc..834d90398cb4 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -842,7 +842,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
- struct inode *dir,
+ struct btrfs_inode *dir,
struct btrfs_dir_item *di)
{
struct btrfs_fs_info *fs_info = root->fs_info;
@@ -874,7 +874,7 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
if (ret)
goto out;
- ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir), BTRFS_I(inode), name, name_len);
+ ret = btrfs_unlink_inode(trans, root, dir, BTRFS_I(inode), name, name_len);
if (ret)
goto out;
else
@@ -1150,7 +1150,7 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
ref_index, name, namelen, 0);
if (di && !IS_ERR(di)) {
- ret = drop_one_dir_item(trans, root, path, dir, di);
+ ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), di);
if (ret)
return ret;
}
@@ -1160,7 +1160,7 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
name, namelen, 0);
if (di && !IS_ERR(di)) {
- ret = drop_one_dir_item(trans, root, path, dir, di);
+ ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), di);
if (ret)
return ret;
}
@@ -1768,7 +1768,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
if (!exists)
goto out;
- ret = drop_one_dir_item(trans, root, path, dir, dst_di);
+ ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), dst_di);
if (ret)
goto out;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 20/24] btrfs: Make __add_inode_ref take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (18 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 19/24] btrfs: Make drop_one_dir_item " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 21/24] btrfs: Make log_inode_item " Nikolay Borisov
` (4 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 834d90398cb4..a24983cd455c 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -990,7 +990,7 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
struct btrfs_root *log_root,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
struct extent_buffer *eb,
u64 inode_objectid, u64 parent_objectid,
u64 ref_index, char *name, int namelen,
@@ -1046,12 +1046,11 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
parent_objectid,
victim_name,
victim_name_len)) {
- inc_nlink(inode);
+ inc_nlink(&inode->vfs_inode);
btrfs_release_path(path);
- ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir),
- BTRFS_I(inode), victim_name,
- victim_name_len);
+ ret = btrfs_unlink_inode(trans, root, dir, inode,
+ victim_name, victim_name_len);
kfree(victim_name);
if (ret)
return ret;
@@ -1113,15 +1112,14 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
parent_objectid, victim_name,
victim_name_len)) {
ret = -ENOENT;
- victim_parent = read_one_inode(root,
- parent_objectid);
+ victim_parent = read_one_inode(root, parent_objectid);
if (victim_parent) {
- inc_nlink(inode);
+ inc_nlink(&inode->vfs_inode);
btrfs_release_path(path);
ret = btrfs_unlink_inode(trans, root,
BTRFS_I(victim_parent),
- BTRFS_I(inode),
+ inode,
victim_name,
victim_name_len);
if (!ret)
@@ -1147,20 +1145,20 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
/* look for a conflicting sequence number */
- di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
+ di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir),
ref_index, name, namelen, 0);
if (di && !IS_ERR(di)) {
- ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), di);
+ ret = drop_one_dir_item(trans, root, path, dir, di);
if (ret)
return ret;
}
btrfs_release_path(path);
/* look for a conflicing name */
- di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
+ di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir),
name, namelen, 0);
if (di && !IS_ERR(di)) {
- ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), di);
+ ret = drop_one_dir_item(trans, root, path, dir, di);
if (ret)
return ret;
}
@@ -1306,7 +1304,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
if (!search_done) {
ret = __add_inode_ref(trans, root, path, log,
- dir, inode, eb,
+ BTRFS_I(dir), BTRFS_I(inode), eb,
inode_objectid,
parent_objectid,
ref_index, name, namelen,
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 21/24] btrfs: Make log_inode_item take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (19 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 20/24] btrfs: Make __add_inode_ref " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 22/24] btrfs: Make btrfs_log_inode " Nikolay Borisov
` (3 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index a24983cd455c..002db48541ff 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3591,19 +3591,18 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
static int log_inode_item(struct btrfs_trans_handle *trans,
struct btrfs_root *log, struct btrfs_path *path,
- struct inode *inode)
+ struct btrfs_inode *inode)
{
struct btrfs_inode_item *inode_item;
int ret;
ret = btrfs_insert_empty_item(trans, log, path,
- &BTRFS_I(inode)->location,
- sizeof(*inode_item));
+ &inode->location, sizeof(*inode_item));
if (ret && ret != -EEXIST)
return ret;
inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_inode_item);
- fill_inode_item(trans, path->nodes[0], inode_item, inode, 0, 0);
+ fill_inode_item(trans, path->nodes[0], inode_item, &inode->vfs_inode, 0, 0);
btrfs_release_path(path);
return 0;
}
@@ -4923,7 +4922,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
btrfs_release_path(dst_path);
if (need_log_inode_item) {
- err = log_inode_item(trans, log, dst_path, inode);
+ err = log_inode_item(trans, log, dst_path, BTRFS_I(inode));
if (err)
goto out_unlock;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 22/24] btrfs: Make btrfs_log_inode take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (20 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 21/24] btrfs: Make log_inode_item " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 23/24] btrfs: Make count_inode_extrefs " Nikolay Borisov
` (2 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 87 ++++++++++++++++++++++++++---------------------------
1 file changed, 43 insertions(+), 44 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 002db48541ff..172faaed2658 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -96,7 +96,7 @@
#define LOG_WALK_REPLAY_ALL 3
static int btrfs_log_inode(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct inode *inode,
+ struct btrfs_root *root, struct btrfs_inode *inode,
int inode_only,
const loff_t start,
const loff_t end,
@@ -4588,7 +4588,7 @@ static int btrfs_check_ref_name_override(struct extent_buffer *eb,
* This handles both files and directories.
*/
static int btrfs_log_inode(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct inode *inode,
+ struct btrfs_root *root, struct btrfs_inode *inode,
int inode_only,
const loff_t start,
const loff_t end,
@@ -4609,8 +4609,8 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
int ins_start_slot = 0;
int ins_nr;
bool fast_search = false;
- u64 ino = btrfs_ino(BTRFS_I(inode));
- struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
+ u64 ino = btrfs_ino(inode);
+ struct extent_map_tree *em_tree = &inode->extent_tree;
u64 logged_isize = 0;
bool need_log_inode_item = true;
@@ -4631,9 +4631,9 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
/* today the code can only do partial logging of directories */
- if (S_ISDIR(inode->i_mode) ||
+ if (S_ISDIR(inode->vfs_inode.i_mode) ||
(!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
- &BTRFS_I(inode)->runtime_flags) &&
+ &inode->runtime_flags) &&
inode_only == LOG_INODE_EXISTS))
max_key.type = BTRFS_XATTR_ITEM_KEY;
else
@@ -4646,11 +4646,11 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* order for the log replay code to mark inodes for link count
* fixup (create temporary BTRFS_TREE_LOG_FIXUP_OBJECTID items).
*/
- if (S_ISDIR(inode->i_mode) ||
- BTRFS_I(inode)->generation > fs_info->last_trans_committed)
- ret = btrfs_commit_inode_delayed_items(trans, BTRFS_I(inode));
+ if (S_ISDIR(inode->vfs_inode.i_mode) ||
+ inode->generation > fs_info->last_trans_committed)
+ ret = btrfs_commit_inode_delayed_items(trans, inode);
else
- ret = btrfs_commit_inode_delayed_inode(BTRFS_I(inode));
+ ret = btrfs_commit_inode_delayed_inode(inode);
if (ret) {
btrfs_free_path(path);
@@ -4658,13 +4658,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
return ret;
}
- mutex_lock(&BTRFS_I(inode)->log_mutex);
+ mutex_lock(&inode->log_mutex);
/*
* a brute force approach to making sure we get the most uptodate
* copies of everything.
*/
- if (S_ISDIR(inode->i_mode)) {
+ if (S_ISDIR(inode->vfs_inode.i_mode)) {
int max_key_type = BTRFS_DIR_LOG_INDEX_KEY;
if (inode_only == LOG_INODE_EXISTS)
@@ -4685,31 +4685,30 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* (zeroes), as if an expanding truncate happened,
* instead of getting a file of 4Kb only.
*/
- err = logged_inode_size(log, BTRFS_I(inode), path,
- &logged_isize);
+ err = logged_inode_size(log, inode, path, &logged_isize);
if (err)
goto out_unlock;
}
if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
- &BTRFS_I(inode)->runtime_flags)) {
+ &inode->runtime_flags)) {
if (inode_only == LOG_INODE_EXISTS) {
max_key.type = BTRFS_XATTR_ITEM_KEY;
ret = drop_objectid_items(trans, log, path, ino,
max_key.type);
} else {
clear_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
- &BTRFS_I(inode)->runtime_flags);
+ &inode->runtime_flags);
clear_bit(BTRFS_INODE_COPY_EVERYTHING,
- &BTRFS_I(inode)->runtime_flags);
+ &inode->runtime_flags);
while(1) {
ret = btrfs_truncate_inode_items(trans,
- log, inode, 0, 0);
+ log, &inode->vfs_inode, 0, 0);
if (ret != -EAGAIN)
break;
}
}
} else if (test_and_clear_bit(BTRFS_INODE_COPY_EVERYTHING,
- &BTRFS_I(inode)->runtime_flags) ||
+ &inode->runtime_flags) ||
inode_only == LOG_INODE_EXISTS) {
if (inode_only == LOG_INODE_ALL)
fast_search = true;
@@ -4750,13 +4749,12 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
if ((min_key.type == BTRFS_INODE_REF_KEY ||
min_key.type == BTRFS_INODE_EXTREF_KEY) &&
- BTRFS_I(inode)->generation == trans->transid) {
+ inode->generation == trans->transid) {
u64 other_ino = 0;
ret = btrfs_check_ref_name_override(path->nodes[0],
- path->slots[0],
- &min_key, BTRFS_I(inode),
- &other_ino);
+ path->slots[0], &min_key, inode,
+ &other_ino);
if (ret < 0) {
err = ret;
goto out_unlock;
@@ -4771,7 +4769,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
ins_nr = 1;
ins_start_slot = path->slots[0];
}
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
+ ret = copy_items(trans, inode, dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only,
logged_isize);
@@ -4809,7 +4807,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* update the log with the new name before we
* unpin it.
*/
- err = btrfs_log_inode(trans, root, other_inode,
+ err = btrfs_log_inode(trans, root, BTRFS_I(other_inode),
LOG_INODE_EXISTS,
0, LLONG_MAX, ctx);
iput(other_inode);
@@ -4824,7 +4822,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
if (min_key.type == BTRFS_XATTR_ITEM_KEY) {
if (ins_nr == 0)
goto next_slot;
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
+ ret = copy_items(trans, inode, dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only, logged_isize);
if (ret < 0) {
@@ -4849,7 +4847,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto next_slot;
}
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent,
+ ret = copy_items(trans, inode, dst_path, path, &last_extent,
ins_start_slot, ins_nr, inode_only,
logged_isize);
if (ret < 0) {
@@ -4873,7 +4871,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto again;
}
if (ins_nr) {
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
+ ret = copy_items(trans, inode, dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only, logged_isize);
if (ret < 0) {
@@ -4895,7 +4893,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
}
}
if (ins_nr) {
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent,
+ ret = copy_items(trans, inode, dst_path, path, &last_extent,
ins_start_slot, ins_nr, inode_only,
logged_isize);
if (ret < 0) {
@@ -4908,13 +4906,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
btrfs_release_path(dst_path);
- err = btrfs_log_all_xattrs(trans, root, BTRFS_I(inode), path, dst_path);
+ err = btrfs_log_all_xattrs(trans, root, inode, path, dst_path);
if (err)
goto out_unlock;
if (max_key.type >= BTRFS_EXTENT_DATA_KEY && !fast_search) {
btrfs_release_path(path);
btrfs_release_path(dst_path);
- err = btrfs_log_trailing_hole(trans, root, BTRFS_I(inode), path);
+ err = btrfs_log_trailing_hole(trans, root, inode, path);
if (err)
goto out_unlock;
}
@@ -4922,12 +4920,12 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
btrfs_release_path(dst_path);
if (need_log_inode_item) {
- err = log_inode_item(trans, log, dst_path, BTRFS_I(inode));
+ err = log_inode_item(trans, log, dst_path, inode);
if (err)
goto out_unlock;
}
if (fast_search) {
- ret = btrfs_log_changed_extents(trans, root, BTRFS_I(inode), dst_path,
+ ret = btrfs_log_changed_extents(trans, root, inode, dst_path,
&logged_list, ctx, start, end);
if (ret) {
err = ret;
@@ -4965,8 +4963,8 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
write_unlock(&em_tree->lock);
}
- if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
- ret = log_directory_changes(trans, root, BTRFS_I(inode), path, dst_path,
+ if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->vfs_inode.i_mode)) {
+ ret = log_directory_changes(trans, root, inode, path, dst_path,
ctx);
if (ret) {
err = ret;
@@ -4974,16 +4972,16 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
}
}
- spin_lock(&BTRFS_I(inode)->lock);
- BTRFS_I(inode)->logged_trans = trans->transid;
- BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans;
- spin_unlock(&BTRFS_I(inode)->lock);
+ spin_lock(&inode->lock);
+ inode->logged_trans = trans->transid;
+ inode->last_log_commit = inode->last_sub_trans;
+ spin_unlock(&inode->lock);
out_unlock:
if (unlikely(err))
btrfs_put_logged_extents(&logged_list);
else
btrfs_submit_logged_extents(&logged_list, log);
- mutex_unlock(&BTRFS_I(inode)->log_mutex);
+ mutex_unlock(&inode->log_mutex);
btrfs_free_path(path);
btrfs_free_path(dst_path);
@@ -5231,7 +5229,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
ctx->log_new_dentries = false;
if (type == BTRFS_FT_DIR || type == BTRFS_FT_SYMLINK)
log_mode = LOG_INODE_ALL;
- ret = btrfs_log_inode(trans, root, di_inode,
+ ret = btrfs_log_inode(trans, root, BTRFS_I(di_inode),
log_mode, 0, LLONG_MAX, ctx);
if (!ret &&
btrfs_must_commit_transaction(trans, BTRFS_I(di_inode)))
@@ -5351,7 +5349,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
if (ctx)
ctx->log_new_dentries = false;
- ret = btrfs_log_inode(trans, root, dir_inode,
+ ret = btrfs_log_inode(trans, root, BTRFS_I(dir_inode),
LOG_INODE_ALL, 0, LLONG_MAX, ctx);
if (!ret &&
btrfs_must_commit_transaction(trans, BTRFS_I(dir_inode)))
@@ -5431,7 +5429,8 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
if (ret)
goto end_no_trans;
- ret = btrfs_log_inode(trans, root, inode, inode_only, start, end, ctx);
+ ret = btrfs_log_inode(trans, root, BTRFS_I(inode), inode_only,
+ start, end, ctx);
if (ret)
goto end_trans;
@@ -5507,7 +5506,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
break;
if (BTRFS_I(inode)->generation > last_committed) {
- ret = btrfs_log_inode(trans, root, inode,
+ ret = btrfs_log_inode(trans, root, BTRFS_I(inode),
LOG_INODE_EXISTS,
0, LLONG_MAX, ctx);
if (ret)
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 23/24] btrfs: Make count_inode_extrefs take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (21 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 22/24] btrfs: Make btrfs_log_inode " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-12 14:00 ` [PATCH 24/24] btrfs: Make count_inode_refs " Nikolay Borisov
2017-01-17 16:15 ` [PATCH 00/24] tree-log inode vs btrfs_inode cleanups David Sterba
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 172faaed2658..0c5eb664640f 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1357,14 +1357,14 @@ static int insert_orphan_item(struct btrfs_trans_handle *trans,
}
static int count_inode_extrefs(struct btrfs_root *root,
- struct inode *inode, struct btrfs_path *path)
+ struct btrfs_inode *inode, struct btrfs_path *path)
{
int ret = 0;
int name_len;
unsigned int nlink = 0;
u32 item_size;
u32 cur_offset = 0;
- u64 inode_objectid = btrfs_ino(BTRFS_I(inode));
+ u64 inode_objectid = btrfs_ino(inode);
u64 offset = 0;
unsigned long ptr;
struct btrfs_inode_extref *extref;
@@ -1486,7 +1486,7 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
nlink = ret;
- ret = count_inode_extrefs(root, inode, path);
+ ret = count_inode_extrefs(root, BTRFS_I(inode), path);
if (ret < 0)
goto out;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH 24/24] btrfs: Make count_inode_refs take btrfs_inode
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (22 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 23/24] btrfs: Make count_inode_extrefs " Nikolay Borisov
@ 2017-01-12 14:00 ` Nikolay Borisov
2017-01-17 16:15 ` [PATCH 00/24] tree-log inode vs btrfs_inode cleanups David Sterba
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-12 14:00 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 0c5eb664640f..162223404eca 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1401,7 +1401,7 @@ static int count_inode_extrefs(struct btrfs_root *root,
}
static int count_inode_refs(struct btrfs_root *root,
- struct inode *inode, struct btrfs_path *path)
+ struct btrfs_inode *inode, struct btrfs_path *path)
{
int ret;
struct btrfs_key key;
@@ -1409,7 +1409,7 @@ static int count_inode_refs(struct btrfs_root *root,
unsigned long ptr;
unsigned long ptr_end;
int name_len;
- u64 ino = btrfs_ino(BTRFS_I(inode));
+ u64 ino = btrfs_ino(inode);
key.objectid = ino;
key.type = BTRFS_INODE_REF_KEY;
@@ -1480,7 +1480,7 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
if (!path)
return -ENOMEM;
- ret = count_inode_refs(root, inode, path);
+ ret = count_inode_refs(root, BTRFS_I(inode), path);
if (ret < 0)
goto out;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* Re: [PATCH 00/24] tree-log inode vs btrfs_inode cleanups
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
` (23 preceding siblings ...)
2017-01-12 14:00 ` [PATCH 24/24] btrfs: Make count_inode_refs " Nikolay Borisov
@ 2017-01-17 16:15 ` David Sterba
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
24 siblings, 1 reply; 53+ messages in thread
From: David Sterba @ 2017-01-17 16:15 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: dsterba, linux-btrfs
On Thu, Jan 12, 2017 at 04:00:26PM +0200, Nikolay Borisov wrote:
> So here is a new set of patches cleaning up tree-log function
> w.r.t inode vs btrfs_inode. There are still some which remain
> but I didn't find compelling arguments to cleaning them up, so
> I've left them unchanged. This time there are some size shrinkage:
>
> text data bss dec hex filename
> 2530598 174661 28288 2733547 29b5eb fs/btrfs/btrfs.ko - upstream master
>
> text data bss dec hex filename
> 2530774 174661 28288 2733723 29b69b fs/btrfs/btrfs.ko - before tree-log cleanup
>
> text data bss dec hex filename
> 2530163 174661 28288 2733112 29b438 fs/btrfs/btrfs.ko - both series applied
>
> So the net result of the 2 series is 435 bytes and I assume there
> will be further reduction in size once further cleanups are made
Thanks. I was about to apply the series but patch 06/24 fails to apply
on anytihing that I could use (master, cmason's integration or the
cleanups-next branch). Can you please refresh it on top of master? The
conflict looks like the patch tries to apply the same change twice to
btrfs_del_dir_entries_in_log, so it would be better is you check.
Thanks.
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCHv2 00/24] tree-log inode vs btrfs_inode cleanups
2017-01-17 16:15 ` [PATCH 00/24] tree-log inode vs btrfs_inode cleanups David Sterba
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 01/24] btrfs: Make btrfs_must_commit_transaction take btrfs_inode Nikolay Borisov
` (24 more replies)
0 siblings, 25 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
So here is a new set of patches cleaning up tree-log function
w.r.t inode vs btrfs_inode. There are still some which remain
but I didn't find compelling arguments to cleaning them up, so
I've left them unchanged. This time there are some size shrinkage:
text data bss dec hex filename
2530598 174661 28288 2733547 29b5eb fs/btrfs/btrfs.ko - upstream master
text data bss dec hex filename
2530774 174661 28288 2733723 29b69b fs/btrfs/btrfs.ko - before tree-log cleanup
text data bss dec hex filename
2530163 174661 28288 2733112 29b438 fs/btrfs/btrfs.ko - both series applied
So the net result of the 2 series is 435 bytes and I assume there
will be further reduction in size once further cleanups are made
Changes since v1:
* Rebased all patche to latest master
Nikolay Borisov (24):
btrfs: Make btrfs_must_commit_transaction take btrfs_inode
btrfs: Make btrfs_record_unlink_dir take btrfs_inode
btrfs: Make btrfs_record_snapshot_destroy take btrfs_inode
btrfs: Make btrfs_inode_in_log take btrfs_inode
btrfs: Make btrfs_log_new_name take btrfs_inode
btrfs: Make btrfs_del_dir_entries_in_log take btrfs_inode
btrfs: Make btrfs_del_inode_ref take btrfs_inode
btrfs: Make logged_inode_size take btrfs_inode
btrfs: Make btrfs_check_ref_name_override take btrfs_inode
btrfs: Make copy_items take btrfs_inode
btrfs: Make btrfs_log_all_xattrs take btrfs_inode
btrfs: Make btrfs_log_trailing_hole take btrfs_inode
btrfs: Make btrfs_get_logged_extents take btrfs_inode
btrfs: Make btrfs_log_changed_extents take btrfs_inode
btrfs: Make log_dir_items take btrfs_inode
btrfs: Make log_directory_changes take btrfs_inode
btrfs: Make log_new_dir_dentries take btrfs_inode
btrfs: Make btrfs_unlink_inode take btrfs_inode
btrfs: Make drop_one_dir_item take btrfs_inode
btrfs: Make __add_inode_ref take btrfs_inode
btrfs: Make log_inode_item take btrfs_inode
btrfs: Make btrfs_log_inode take btrfs_inode
btrfs: Make count_inode_extrefs take btrfs_inode
btrfs: Make count_inode_refs take btrfs_inode
fs/btrfs/btrfs_inode.h | 16 ++-
fs/btrfs/ctree.h | 2 +-
fs/btrfs/file.c | 2 +-
fs/btrfs/inode.c | 90 ++++++++-------
fs/btrfs/ioctl.c | 2 +-
fs/btrfs/ordered-data.c | 4 +-
fs/btrfs/ordered-data.h | 2 +-
fs/btrfs/tree-log.c | 288 +++++++++++++++++++++++-------------------------
fs/btrfs/tree-log.h | 10 +-
9 files changed, 201 insertions(+), 215 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCHv2 01/24] btrfs: Make btrfs_must_commit_transaction take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 02/24] btrfs: Make btrfs_record_unlink_dir " Nikolay Borisov
` (23 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index b814cd7bbe70..a2a822a993af 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5021,13 +5021,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* we logged the inode or it might have also done the unlink).
*/
static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans,
- struct inode *inode)
+ struct btrfs_inode *inode)
{
- struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
+ struct btrfs_fs_info *fs_info = inode->root->fs_info;
bool ret = false;
- mutex_lock(&BTRFS_I(inode)->log_mutex);
- if (BTRFS_I(inode)->last_unlink_trans > fs_info->last_trans_committed) {
+ mutex_lock(&inode->log_mutex);
+ if (inode->last_unlink_trans > fs_info->last_trans_committed) {
/*
* Make sure any commits to the log are forced to be full
* commits.
@@ -5035,7 +5035,7 @@ static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans,
btrfs_set_log_full_commit(fs_info, trans);
ret = true;
}
- mutex_unlock(&BTRFS_I(inode)->log_mutex);
+ mutex_unlock(&inode->log_mutex);
return ret;
}
@@ -5084,7 +5084,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
BTRFS_I(inode)->logged_trans = trans->transid;
smp_mb();
- if (btrfs_must_commit_transaction(trans, inode)) {
+ if (btrfs_must_commit_transaction(trans, BTRFS_I(inode))) {
ret = 1;
break;
}
@@ -5094,7 +5094,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
if (IS_ROOT(parent)) {
inode = d_inode(parent);
- if (btrfs_must_commit_transaction(trans, inode))
+ if (btrfs_must_commit_transaction(trans, BTRFS_I(inode)))
ret = 1;
break;
}
@@ -5248,7 +5248,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
ret = btrfs_log_inode(trans, root, di_inode,
log_mode, 0, LLONG_MAX, ctx);
if (!ret &&
- btrfs_must_commit_transaction(trans, di_inode))
+ btrfs_must_commit_transaction(trans, BTRFS_I(di_inode)))
ret = 1;
iput(di_inode);
if (ret)
@@ -5368,7 +5368,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
ret = btrfs_log_inode(trans, root, dir_inode,
LOG_INODE_ALL, 0, LLONG_MAX, ctx);
if (!ret &&
- btrfs_must_commit_transaction(trans, dir_inode))
+ btrfs_must_commit_transaction(trans, BTRFS_I(dir_inode)))
ret = 1;
if (!ret && ctx && ctx->log_new_dentries)
ret = log_new_dir_dentries(trans, root,
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 02/24] btrfs: Make btrfs_record_unlink_dir take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 01/24] btrfs: Make btrfs_must_commit_transaction take btrfs_inode Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 03/24] btrfs: Make btrfs_record_snapshot_destroy " Nikolay Borisov
` (22 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/inode.c | 8 ++++----
fs/btrfs/tree-log.c | 18 +++++++++---------
fs/btrfs/tree-log.h | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d49c3b78e2fb..a8374f1d8c61 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4142,7 +4142,7 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
if (IS_ERR(trans))
return PTR_ERR(trans);
- btrfs_record_unlink_dir(trans, dir, d_inode(dentry), 0);
+ btrfs_record_unlink_dir(trans, BTRFS_I(dir), BTRFS_I(d_inode(dentry)), 0);
ret = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
dentry->d_name.name, dentry->d_name.len);
@@ -9593,8 +9593,8 @@ static int btrfs_rename_exchange(struct inode *old_dir,
new_inode->i_ctime = ctime;
if (old_dentry->d_parent != new_dentry->d_parent) {
- btrfs_record_unlink_dir(trans, old_dir, old_inode, 1);
- btrfs_record_unlink_dir(trans, new_dir, new_inode, 1);
+ btrfs_record_unlink_dir(trans, BTRFS_I(old_dir), BTRFS_I(old_inode), 1);
+ btrfs_record_unlink_dir(trans, BTRFS_I(new_dir), BTRFS_I(new_inode), 1);
}
/* src is a subvolume */
@@ -9873,7 +9873,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
old_inode->i_ctime = current_time(old_dir);
if (old_dentry->d_parent != new_dentry->d_parent)
- btrfs_record_unlink_dir(trans, old_dir, old_inode, 1);
+ btrfs_record_unlink_dir(trans, BTRFS_I(old_dir), BTRFS_I(old_inode), 1);
if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) {
root_objectid = BTRFS_I(old_inode)->root->root_key.objectid;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index a2a822a993af..6f9a3beb7050 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5730,7 +5730,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
* inodes, etc) are done.
*/
void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
int for_rename)
{
/*
@@ -5743,23 +5743,23 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
* into the file. When the file is logged we check it and
* don't log the parents if the file is fully on disk.
*/
- mutex_lock(&BTRFS_I(inode)->log_mutex);
- BTRFS_I(inode)->last_unlink_trans = trans->transid;
- mutex_unlock(&BTRFS_I(inode)->log_mutex);
+ mutex_lock(&inode->log_mutex);
+ inode->last_unlink_trans = trans->transid;
+ mutex_unlock(&inode->log_mutex);
/*
* if this directory was already logged any new
* names for this file/dir will get recorded
*/
smp_mb();
- if (BTRFS_I(dir)->logged_trans == trans->transid)
+ if (dir->logged_trans == trans->transid)
return;
/*
* if the inode we're about to unlink was logged,
* the log will be properly updated for any new names
*/
- if (BTRFS_I(inode)->logged_trans == trans->transid)
+ if (inode->logged_trans == trans->transid)
return;
/*
@@ -5776,9 +5776,9 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
return;
record:
- mutex_lock(&BTRFS_I(dir)->log_mutex);
- BTRFS_I(dir)->last_unlink_trans = trans->transid;
- mutex_unlock(&BTRFS_I(dir)->log_mutex);
+ mutex_lock(&dir->log_mutex);
+ dir->last_unlink_trans = trans->transid;
+ mutex_unlock(&dir->log_mutex);
}
/*
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index ab858e31ccbc..69702eef9603 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -80,7 +80,7 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
void btrfs_end_log_trans(struct btrfs_root *root);
int btrfs_pin_log_trans(struct btrfs_root *root);
void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
int for_rename);
void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
struct inode *dir);
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 03/24] btrfs: Make btrfs_record_snapshot_destroy take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 01/24] btrfs: Make btrfs_must_commit_transaction take btrfs_inode Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 02/24] btrfs: Make btrfs_record_unlink_dir " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 04/24] btrfs: Make btrfs_inode_in_log " Nikolay Borisov
` (21 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/ioctl.c | 2 +-
fs/btrfs/tree-log.c | 8 ++++----
fs/btrfs/tree-log.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index e8e1f5f5f93a..7d1b5378de49 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2497,7 +2497,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
trans->block_rsv = &block_rsv;
trans->bytes_reserved = block_rsv.size;
- btrfs_record_snapshot_destroy(trans, dir);
+ btrfs_record_snapshot_destroy(trans, BTRFS_I(dir));
ret = btrfs_unlink_subvol(trans, root, dir,
dest->root_key.objectid,
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 6f9a3beb7050..581d31171683 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5794,11 +5794,11 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
* parent root and tree of tree roots trees, etc) are done.
*/
void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
- struct inode *dir)
+ struct btrfs_inode *dir)
{
- mutex_lock(&BTRFS_I(dir)->log_mutex);
- BTRFS_I(dir)->last_unlink_trans = trans->transid;
- mutex_unlock(&BTRFS_I(dir)->log_mutex);
+ mutex_lock(&dir->log_mutex);
+ dir->last_unlink_trans = trans->transid;
+ mutex_unlock(&dir->log_mutex);
}
/*
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index 69702eef9603..e08ce78b2ad4 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -83,7 +83,7 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
struct btrfs_inode *dir, struct btrfs_inode *inode,
int for_rename);
void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
- struct inode *dir);
+ struct btrfs_inode *dir);
int btrfs_log_new_name(struct btrfs_trans_handle *trans,
struct inode *inode, struct inode *old_dir,
struct dentry *parent);
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 04/24] btrfs: Make btrfs_inode_in_log take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (2 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 03/24] btrfs: Make btrfs_record_snapshot_destroy " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 05/24] btrfs: Make btrfs_log_new_name " Nikolay Borisov
` (20 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/btrfs_inode.h | 16 +++++++---------
fs/btrfs/file.c | 2 +-
fs/btrfs/inode.c | 16 ++++++++--------
fs/btrfs/tree-log.c | 4 ++--
4 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 4fed080545c6..b2dde0efebc0 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -255,16 +255,14 @@ static inline bool btrfs_is_free_space_inode(struct inode *inode)
return false;
}
-static inline int btrfs_inode_in_log(struct inode *inode, u64 generation)
+static inline int btrfs_inode_in_log(struct btrfs_inode *inode, u64 generation)
{
int ret = 0;
- spin_lock(&BTRFS_I(inode)->lock);
- if (BTRFS_I(inode)->logged_trans == generation &&
- BTRFS_I(inode)->last_sub_trans <=
- BTRFS_I(inode)->last_log_commit &&
- BTRFS_I(inode)->last_sub_trans <=
- BTRFS_I(inode)->root->last_log_commit) {
+ spin_lock(&inode->lock);
+ if (inode->logged_trans == generation &&
+ inode->last_sub_trans <= inode->last_log_commit &&
+ inode->last_sub_trans <= inode->root->last_log_commit) {
/*
* After a ranged fsync we might have left some extent maps
* (that fall outside the fsync's range). So return false
@@ -272,10 +270,10 @@ static inline int btrfs_inode_in_log(struct inode *inode, u64 generation)
* will be called and process those extent maps.
*/
smp_mb();
- if (list_empty(&BTRFS_I(inode)->extent_tree.modified_extents))
+ if (list_empty(&inode->extent_tree.modified_extents))
ret = 1;
}
- spin_unlock(&BTRFS_I(inode)->lock);
+ spin_unlock(&inode->lock);
return ret;
}
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 0d32f45cef28..149b79b3aaf8 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2062,7 +2062,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
* commit does not start nor waits for ordered extents to complete.
*/
smp_mb();
- if (btrfs_inode_in_log(inode, fs_info->generation) ||
+ if (btrfs_inode_in_log(BTRFS_I(inode), fs_info->generation) ||
(full_sync && BTRFS_I(inode)->last_trans <=
fs_info->last_trans_committed) ||
(!btrfs_have_ordered_extents_in_range(inode, start, len) &&
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a8374f1d8c61..9442c80fe551 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9683,11 +9683,11 @@ static int btrfs_rename_exchange(struct inode *old_dir,
* allow the tasks to sync it.
*/
if (ret && (root_log_pinned || dest_log_pinned)) {
- if (btrfs_inode_in_log(old_dir, fs_info->generation) ||
- btrfs_inode_in_log(new_dir, fs_info->generation) ||
- btrfs_inode_in_log(old_inode, fs_info->generation) ||
+ if (btrfs_inode_in_log(BTRFS_I(old_dir), fs_info->generation) ||
+ btrfs_inode_in_log(BTRFS_I(new_dir), fs_info->generation) ||
+ btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) ||
(new_inode &&
- btrfs_inode_in_log(new_inode, fs_info->generation)))
+ btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation)))
btrfs_set_log_full_commit(fs_info, trans);
if (root_log_pinned) {
@@ -9959,11 +9959,11 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
* allow the tasks to sync it.
*/
if (ret && log_pinned) {
- if (btrfs_inode_in_log(old_dir, fs_info->generation) ||
- btrfs_inode_in_log(new_dir, fs_info->generation) ||
- btrfs_inode_in_log(old_inode, fs_info->generation) ||
+ if (btrfs_inode_in_log(BTRFS_I(old_dir), fs_info->generation) ||
+ btrfs_inode_in_log(BTRFS_I(new_dir), fs_info->generation) ||
+ btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) ||
(new_inode &&
- btrfs_inode_in_log(new_inode, fs_info->generation)))
+ btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation)))
btrfs_set_log_full_commit(fs_info, trans);
btrfs_end_log_trans(root);
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 581d31171683..37adad5dabd6 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5237,7 +5237,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
goto next_dir_inode;
}
- if (btrfs_inode_in_log(di_inode, trans->transid)) {
+ if (btrfs_inode_in_log(BTRFS_I(di_inode), trans->transid)) {
iput(di_inode);
break;
}
@@ -5436,7 +5436,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
if (ret)
goto end_no_trans;
- if (btrfs_inode_in_log(inode, trans->transid)) {
+ if (btrfs_inode_in_log(BTRFS_I(inode), trans->transid)) {
ret = BTRFS_NO_LOG_SYNC;
goto end_no_trans;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 05/24] btrfs: Make btrfs_log_new_name take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (3 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 04/24] btrfs: Make btrfs_inode_in_log " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 06/24] btrfs: Make btrfs_del_dir_entries_in_log " Nikolay Borisov
` (19 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/inode.c | 8 ++++----
fs/btrfs/tree-log.c | 18 ++++++++----------
fs/btrfs/tree-log.h | 2 +-
3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9442c80fe551..41b1e2ed63b4 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6600,7 +6600,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
goto fail;
}
d_instantiate(dentry, inode);
- btrfs_log_new_name(trans, inode, NULL, parent);
+ btrfs_log_new_name(trans, BTRFS_I(inode), NULL, parent);
}
btrfs_balance_delayed_items(fs_info);
@@ -9660,13 +9660,13 @@ static int btrfs_rename_exchange(struct inode *old_dir,
if (root_log_pinned) {
parent = new_dentry->d_parent;
- btrfs_log_new_name(trans, old_inode, old_dir, parent);
+ btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), parent);
btrfs_end_log_trans(root);
root_log_pinned = false;
}
if (dest_log_pinned) {
parent = old_dentry->d_parent;
- btrfs_log_new_name(trans, new_inode, new_dir, parent);
+ btrfs_log_new_name(trans, BTRFS_I(new_inode), BTRFS_I(new_dir), parent);
btrfs_end_log_trans(dest);
dest_log_pinned = false;
}
@@ -9932,7 +9932,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (log_pinned) {
struct dentry *parent = new_dentry->d_parent;
- btrfs_log_new_name(trans, old_inode, old_dir, parent);
+ btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), parent);
btrfs_end_log_trans(root);
log_pinned = false;
}
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 37adad5dabd6..df822908f2be 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5809,30 +5809,28 @@ void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
* full transaction commit is required.
*/
int btrfs_log_new_name(struct btrfs_trans_handle *trans,
- struct inode *inode, struct inode *old_dir,
+ struct btrfs_inode *inode, struct btrfs_inode *old_dir,
struct dentry *parent)
{
- struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
- struct btrfs_root * root = BTRFS_I(inode)->root;
+ struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
+ struct btrfs_root * root = inode->root;
/*
* this will force the logging code to walk the dentry chain
* up for the file
*/
- if (S_ISREG(inode->i_mode))
- BTRFS_I(inode)->last_unlink_trans = trans->transid;
+ if (S_ISREG(inode->vfs_inode.i_mode))
+ inode->last_unlink_trans = trans->transid;
/*
* if this inode hasn't been logged and directory we're renaming it
* from hasn't been logged, we don't need to log it
*/
- if (BTRFS_I(inode)->logged_trans <=
- fs_info->last_trans_committed &&
- (!old_dir || BTRFS_I(old_dir)->logged_trans <=
- fs_info->last_trans_committed))
+ if (inode->logged_trans <= fs_info->last_trans_committed &&
+ (!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed))
return 0;
- return btrfs_log_inode_parent(trans, root, inode, parent, 0,
+ return btrfs_log_inode_parent(trans, root, &inode->vfs_inode, parent, 0,
LLONG_MAX, 1, NULL);
}
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index e08ce78b2ad4..2bcbac7efa9c 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -85,6 +85,6 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
struct btrfs_inode *dir);
int btrfs_log_new_name(struct btrfs_trans_handle *trans,
- struct inode *inode, struct inode *old_dir,
+ struct btrfs_inode *inode, struct btrfs_inode *old_dir,
struct dentry *parent);
#endif
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 06/24] btrfs: Make btrfs_del_dir_entries_in_log take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (4 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 05/24] btrfs: Make btrfs_log_new_name " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 07/24] btrfs: Make btrfs_del_inode_ref " Nikolay Borisov
` (18 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/inode.c | 2 +-
fs/btrfs/tree-log.c | 10 +++++-----
fs/btrfs/tree-log.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 41b1e2ed63b4..ebfeabafe1b1 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4075,7 +4075,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
}
ret = btrfs_del_dir_entries_in_log(trans, root, name, name_len,
- dir, index);
+ BTRFS_I(dir), index);
if (ret == -ENOENT)
ret = 0;
else if (ret)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index df822908f2be..caa8d886b4ae 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3084,7 +3084,7 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans,
int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
- struct inode *dir, u64 index)
+ struct btrfs_inode *dir, u64 index)
{
struct btrfs_root *log;
struct btrfs_dir_item *di;
@@ -3092,16 +3092,16 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
int ret;
int err = 0;
int bytes_del = 0;
- u64 dir_ino = btrfs_ino(BTRFS_I(dir));
+ u64 dir_ino = btrfs_ino(dir);
- if (BTRFS_I(dir)->logged_trans < trans->transid)
+ if (dir->logged_trans < trans->transid)
return 0;
ret = join_running_log_trans(root);
if (ret)
return 0;
- mutex_lock(&BTRFS_I(dir)->log_mutex);
+ mutex_lock(&dir->log_mutex);
log = root->log_root;
path = btrfs_alloc_path();
@@ -3176,7 +3176,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
fail:
btrfs_free_path(path);
out_unlock:
- mutex_unlock(&BTRFS_I(dir)->log_mutex);
+ mutex_unlock(&dir->log_mutex);
if (ret == -ENOSPC) {
btrfs_set_log_full_commit(root->fs_info, trans);
ret = 0;
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index 2bcbac7efa9c..6c2b316b28e0 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -72,7 +72,7 @@ int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans,
int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
- struct inode *dir, u64 index);
+ struct btrfs_inode *dir, u64 index);
int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 07/24] btrfs: Make btrfs_del_inode_ref take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (5 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 06/24] btrfs: Make btrfs_del_dir_entries_in_log " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 08/24] btrfs: Make logged_inode_size " Nikolay Borisov
` (17 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/inode.c | 2 +-
fs/btrfs/tree-log.c | 10 +++++-----
fs/btrfs/tree-log.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ebfeabafe1b1..e86b08eabb82 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4068,7 +4068,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
}
ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len,
- inode, dir_ino);
+ BTRFS_I(inode), dir_ino);
if (ret != 0 && ret != -ENOENT) {
btrfs_abort_transaction(trans, ret);
goto err;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index caa8d886b4ae..a7705173150e 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3192,25 +3192,25 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
- struct inode *inode, u64 dirid)
+ struct btrfs_inode *inode, u64 dirid)
{
struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_root *log;
u64 index;
int ret;
- if (BTRFS_I(inode)->logged_trans < trans->transid)
+ if (inode->logged_trans < trans->transid)
return 0;
ret = join_running_log_trans(root);
if (ret)
return 0;
log = root->log_root;
- mutex_lock(&BTRFS_I(inode)->log_mutex);
+ mutex_lock(&inode->log_mutex);
- ret = btrfs_del_inode_ref(trans, log, name, name_len, btrfs_ino(BTRFS_I(inode)),
+ ret = btrfs_del_inode_ref(trans, log, name, name_len, btrfs_ino(inode),
dirid, &index);
- mutex_unlock(&BTRFS_I(inode)->log_mutex);
+ mutex_unlock(&inode->log_mutex);
if (ret == -ENOSPC) {
btrfs_set_log_full_commit(fs_info, trans);
ret = 0;
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h
index 6c2b316b28e0..bc50f128c6be 100644
--- a/fs/btrfs/tree-log.h
+++ b/fs/btrfs/tree-log.h
@@ -76,7 +76,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
- struct inode *inode, u64 dirid);
+ struct btrfs_inode *inode, u64 dirid);
void btrfs_end_log_trans(struct btrfs_root *root);
int btrfs_pin_log_trans(struct btrfs_root *root);
void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 08/24] btrfs: Make logged_inode_size take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (6 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 07/24] btrfs: Make btrfs_del_inode_ref " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 09/24] btrfs: Make btrfs_check_ref_name_override " Nikolay Borisov
` (16 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index a7705173150e..20718cfebf89 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4241,13 +4241,13 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
return ret;
}
-static int logged_inode_size(struct btrfs_root *log, struct inode *inode,
+static int logged_inode_size(struct btrfs_root *log, struct btrfs_inode *inode,
struct btrfs_path *path, u64 *size_ret)
{
struct btrfs_key key;
int ret;
- key.objectid = btrfs_ino(BTRFS_I(inode));
+ key.objectid = btrfs_ino(inode);
key.type = BTRFS_INODE_ITEM_KEY;
key.offset = 0;
@@ -4699,7 +4699,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* (zeroes), as if an expanding truncate happened,
* instead of getting a file of 4Kb only.
*/
- err = logged_inode_size(log, inode, path,
+ err = logged_inode_size(log, BTRFS_I(inode), path,
&logged_isize);
if (err)
goto out_unlock;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 09/24] btrfs: Make btrfs_check_ref_name_override take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (7 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 08/24] btrfs: Make logged_inode_size " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 10/24] btrfs: Make copy_items " Nikolay Borisov
` (15 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 20718cfebf89..7669e95be423 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4495,7 +4495,7 @@ static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans,
static int btrfs_check_ref_name_override(struct extent_buffer *eb,
const int slot,
const struct btrfs_key *key,
- struct inode *inode,
+ struct btrfs_inode *inode,
u64 *other_ino)
{
int ret;
@@ -4551,9 +4551,8 @@ static int btrfs_check_ref_name_override(struct extent_buffer *eb,
}
read_extent_buffer(eb, name, name_ptr, this_name_len);
- di = btrfs_lookup_dir_item(NULL, BTRFS_I(inode)->root,
- search_path, parent,
- name, this_name_len, 0);
+ di = btrfs_lookup_dir_item(NULL, inode->root, search_path,
+ parent, name, this_name_len, 0);
if (di && !IS_ERR(di)) {
struct btrfs_key di_key;
@@ -4769,7 +4768,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
ret = btrfs_check_ref_name_override(path->nodes[0],
path->slots[0],
- &min_key, inode,
+ &min_key, BTRFS_I(inode),
&other_ino);
if (ret < 0) {
err = ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 10/24] btrfs: Make copy_items take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (8 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 09/24] btrfs: Make btrfs_check_ref_name_override " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 11/24] btrfs: Make btrfs_log_all_xattrs " Nikolay Borisov
` (14 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 40 +++++++++++++++++++---------------------
1 file changed, 19 insertions(+), 21 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 7669e95be423..12872bf492bd 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3613,16 +3613,16 @@ static int log_inode_item(struct btrfs_trans_handle *trans,
}
static noinline int copy_items(struct btrfs_trans_handle *trans,
- struct inode *inode,
+ struct btrfs_inode *inode,
struct btrfs_path *dst_path,
struct btrfs_path *src_path, u64 *last_extent,
int start_slot, int nr, int inode_only,
u64 logged_isize)
{
- struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+ struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
unsigned long src_offset;
unsigned long dst_offset;
- struct btrfs_root *log = BTRFS_I(inode)->root->log_root;
+ struct btrfs_root *log = inode->root->log_root;
struct btrfs_file_extent_item *extent;
struct btrfs_inode_item *inode_item;
struct extent_buffer *src = src_path->nodes[0];
@@ -3633,7 +3633,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
char *ins_data;
int i;
struct list_head ordered_sums;
- int skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
+ int skip_csum = inode->flags & BTRFS_INODE_NODATASUM;
bool has_extents = false;
bool need_find_last_extent = true;
bool done = false;
@@ -3675,7 +3675,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
dst_path->slots[0],
struct btrfs_inode_item);
fill_inode_item(trans, dst_path->nodes[0], inode_item,
- inode, inode_only == LOG_INODE_EXISTS,
+ &inode->vfs_inode, inode_only == LOG_INODE_EXISTS,
logged_isize);
} else {
copy_extent_buffer(dst_path->nodes[0], src, dst_offset,
@@ -3783,7 +3783,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
if (need_find_last_extent) {
u64 len;
- ret = btrfs_prev_leaf(BTRFS_I(inode)->root, src_path);
+ ret = btrfs_prev_leaf(inode->root, src_path);
if (ret < 0)
return ret;
if (ret)
@@ -3792,7 +3792,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
src_path->slots[0]--;
src = src_path->nodes[0];
btrfs_item_key_to_cpu(src, &key, src_path->slots[0]);
- if (key.objectid != btrfs_ino(BTRFS_I(inode)) ||
+ if (key.objectid != btrfs_ino(inode) ||
key.type != BTRFS_EXTENT_DATA_KEY)
goto fill_holes;
extent = btrfs_item_ptr(src, src_path->slots[0],
@@ -3825,8 +3825,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
if (need_find_last_extent) {
/* btrfs_prev_leaf could return 1 without releasing the path */
btrfs_release_path(src_path);
- ret = btrfs_search_slot(NULL, BTRFS_I(inode)->root, &first_key,
- src_path, 0, 0);
+ ret = btrfs_search_slot(NULL, inode->root, &first_key, src_path, 0, 0);
if (ret < 0)
return ret;
ASSERT(ret == 0);
@@ -3846,7 +3845,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
u64 extent_end;
if (i >= btrfs_header_nritems(src_path->nodes[0])) {
- ret = btrfs_next_leaf(BTRFS_I(inode)->root, src_path);
+ ret = btrfs_next_leaf(inode->root, src_path);
if (ret < 0)
return ret;
ASSERT(ret == 0);
@@ -3857,7 +3856,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
btrfs_item_key_to_cpu(src, &key, i);
if (!btrfs_comp_cpu_keys(&key, &last_key))
done = true;
- if (key.objectid != btrfs_ino(BTRFS_I(inode)) ||
+ if (key.objectid != btrfs_ino(inode) ||
key.type != BTRFS_EXTENT_DATA_KEY) {
i++;
continue;
@@ -3880,9 +3879,8 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
}
offset = *last_extent;
len = key.offset - *last_extent;
- ret = btrfs_insert_file_extent(trans, log, btrfs_ino(BTRFS_I(inode)),
- offset, 0, 0, len, 0, len, 0,
- 0, 0);
+ ret = btrfs_insert_file_extent(trans, log, btrfs_ino(inode),
+ offset, 0, 0, len, 0, len, 0, 0, 0);
if (ret)
break;
*last_extent = extent_end;
@@ -4306,7 +4304,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
if (ins_nr > 0) {
u64 last_extent = 0;
- ret = copy_items(trans, inode, dst_path, path,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
&last_extent, start_slot,
ins_nr, 1, 0);
/* can't be 1, extent items aren't processed */
@@ -4336,7 +4334,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
if (ins_nr > 0) {
u64 last_extent = 0;
- ret = copy_items(trans, inode, dst_path, path,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
&last_extent, start_slot,
ins_nr, 1, 0);
/* can't be 1, extent items aren't processed */
@@ -4784,7 +4782,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
ins_nr = 1;
ins_start_slot = path->slots[0];
}
- ret = copy_items(trans, inode, dst_path, path,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only,
logged_isize);
@@ -4837,7 +4835,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
if (min_key.type == BTRFS_XATTR_ITEM_KEY) {
if (ins_nr == 0)
goto next_slot;
- ret = copy_items(trans, inode, dst_path, path,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only, logged_isize);
if (ret < 0) {
@@ -4862,7 +4860,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto next_slot;
}
- ret = copy_items(trans, inode, dst_path, path, &last_extent,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent,
ins_start_slot, ins_nr, inode_only,
logged_isize);
if (ret < 0) {
@@ -4886,7 +4884,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto again;
}
if (ins_nr) {
- ret = copy_items(trans, inode, dst_path, path,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only, logged_isize);
if (ret < 0) {
@@ -4908,7 +4906,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
}
}
if (ins_nr) {
- ret = copy_items(trans, inode, dst_path, path, &last_extent,
+ ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent,
ins_start_slot, ins_nr, inode_only,
logged_isize);
if (ret < 0) {
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 11/24] btrfs: Make btrfs_log_all_xattrs take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (9 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 10/24] btrfs: Make copy_items " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 12/24] btrfs: Make btrfs_log_trailing_hole " Nikolay Borisov
` (13 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 12872bf492bd..1301c517c2f0 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4277,13 +4277,13 @@ static int logged_inode_size(struct btrfs_root *log, struct btrfs_inode *inode,
*/
static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *inode,
+ struct btrfs_inode *inode,
struct btrfs_path *path,
struct btrfs_path *dst_path)
{
int ret;
struct btrfs_key key;
- const u64 ino = btrfs_ino(BTRFS_I(inode));
+ const u64 ino = btrfs_ino(inode);
int ins_nr = 0;
int start_slot = 0;
@@ -4304,7 +4304,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
if (ins_nr > 0) {
u64 last_extent = 0;
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
+ ret = copy_items(trans, inode, dst_path, path,
&last_extent, start_slot,
ins_nr, 1, 0);
/* can't be 1, extent items aren't processed */
@@ -4334,7 +4334,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
if (ins_nr > 0) {
u64 last_extent = 0;
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
+ ret = copy_items(trans, inode, dst_path, path,
&last_extent, start_slot,
ins_nr, 1, 0);
/* can't be 1, extent items aren't processed */
@@ -4919,7 +4919,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
btrfs_release_path(dst_path);
- err = btrfs_log_all_xattrs(trans, root, inode, path, dst_path);
+ err = btrfs_log_all_xattrs(trans, root, BTRFS_I(inode), path, dst_path);
if (err)
goto out_unlock;
if (max_key.type >= BTRFS_EXTENT_DATA_KEY && !fast_search) {
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 12/24] btrfs: Make btrfs_log_trailing_hole take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (10 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 11/24] btrfs: Make btrfs_log_all_xattrs " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 13/24] btrfs: Make btrfs_get_logged_extents " Nikolay Borisov
` (12 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 1301c517c2f0..9f2c42016825 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4372,7 +4372,7 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans,
*/
static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *inode,
+ struct btrfs_inode *inode,
struct btrfs_path *path)
{
struct btrfs_fs_info *fs_info = root->fs_info;
@@ -4382,8 +4382,8 @@ static int btrfs_log_trailing_hole(struct btrfs_trans_handle *trans,
u64 hole_size;
struct extent_buffer *leaf;
struct btrfs_root *log = root->log_root;
- const u64 ino = btrfs_ino(BTRFS_I(inode));
- const u64 i_size = i_size_read(inode);
+ const u64 ino = btrfs_ino(inode);
+ const u64 i_size = i_size_read(&inode->vfs_inode);
if (!btrfs_fs_incompat(fs_info, NO_HOLES))
return 0;
@@ -4925,7 +4925,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
if (max_key.type >= BTRFS_EXTENT_DATA_KEY && !fast_search) {
btrfs_release_path(path);
btrfs_release_path(dst_path);
- err = btrfs_log_trailing_hole(trans, root, inode, path);
+ err = btrfs_log_trailing_hole(trans, root, BTRFS_I(inode), path);
if (err)
goto out_unlock;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 13/24] btrfs: Make btrfs_get_logged_extents take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (11 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 12/24] btrfs: Make btrfs_log_trailing_hole " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 14/24] btrfs: Make btrfs_log_changed_extents " Nikolay Borisov
` (11 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/ordered-data.c | 4 ++--
fs/btrfs/ordered-data.h | 2 +-
fs/btrfs/tree-log.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 041c3326d109..7ae350a64c77 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -432,7 +432,7 @@ int btrfs_dec_test_ordered_pending(struct inode *inode,
}
/* Needs to either be called under a log transaction or the log_mutex */
-void btrfs_get_logged_extents(struct inode *inode,
+void btrfs_get_logged_extents(struct btrfs_inode *inode,
struct list_head *logged_list,
const loff_t start,
const loff_t end)
@@ -442,7 +442,7 @@ void btrfs_get_logged_extents(struct inode *inode,
struct rb_node *n;
struct rb_node *prev;
- tree = &BTRFS_I(inode)->ordered_tree;
+ tree = &inode->ordered_tree;
spin_lock_irq(&tree->lock);
n = __tree_search(&tree->tree, end, &prev);
if (!n)
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index 5f2b0ca28705..b02b71d41d83 100644
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -201,7 +201,7 @@ int btrfs_wait_ordered_extents(struct btrfs_root *root, int nr,
const u64 range_start, const u64 range_len);
int btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, int nr,
const u64 range_start, const u64 range_len);
-void btrfs_get_logged_extents(struct inode *inode,
+void btrfs_get_logged_extents(struct btrfs_inode *inode,
struct list_head *logged_list,
const loff_t start,
const loff_t end);
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 9f2c42016825..0e061f91055e 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4193,7 +4193,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
}
list_sort(NULL, &extents, extent_cmp);
- btrfs_get_logged_extents(inode, logged_list, start, end);
+ btrfs_get_logged_extents(BTRFS_I(inode), logged_list, start, end);
/*
* Some ordered extents started by fsync might have completed
* before we could collect them into the list logged_list, which
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 14/24] btrfs: Make btrfs_log_changed_extents take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (12 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 13/24] btrfs: Make btrfs_get_logged_extents " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 15/24] btrfs: Make log_dir_items " Nikolay Borisov
` (10 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 0e061f91055e..e293ae0e18d7 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4053,7 +4053,7 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans,
}
static int log_one_extent(struct btrfs_trans_handle *trans,
- struct inode *inode, struct btrfs_root *root,
+ struct btrfs_inode *inode, struct btrfs_root *root,
const struct extent_map *em,
struct btrfs_path *path,
const struct list_head *logged_list,
@@ -4070,7 +4070,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
int extent_inserted = 0;
bool ordered_io_err = false;
- ret = wait_ordered_extents(trans, inode, root, em, logged_list,
+ ret = wait_ordered_extents(trans, &inode->vfs_inode, root, em, logged_list,
&ordered_io_err);
if (ret)
return ret;
@@ -4082,14 +4082,14 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
btrfs_init_map_token(&token);
- ret = __btrfs_drop_extents(trans, log, inode, path, em->start,
+ ret = __btrfs_drop_extents(trans, log, &inode->vfs_inode, path, em->start,
em->start + em->len, NULL, 0, 1,
sizeof(*fi), &extent_inserted);
if (ret)
return ret;
if (!extent_inserted) {
- key.objectid = btrfs_ino(BTRFS_I(inode));
+ key.objectid = btrfs_ino(inode);
key.type = BTRFS_EXTENT_DATA_KEY;
key.offset = em->start;
@@ -4148,7 +4148,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *inode,
+ struct btrfs_inode *inode,
struct btrfs_path *path,
struct list_head *logged_list,
struct btrfs_log_ctx *ctx,
@@ -4157,14 +4157,14 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
{
struct extent_map *em, *n;
struct list_head extents;
- struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree;
+ struct extent_map_tree *tree = &inode->extent_tree;
u64 test_gen;
int ret = 0;
int num = 0;
INIT_LIST_HEAD(&extents);
- down_write(&BTRFS_I(inode)->dio_sem);
+ down_write(&inode->dio_sem);
write_lock(&tree->lock);
test_gen = root->fs_info->last_trans_committed;
@@ -4193,7 +4193,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
}
list_sort(NULL, &extents, extent_cmp);
- btrfs_get_logged_extents(BTRFS_I(inode), logged_list, start, end);
+ btrfs_get_logged_extents(inode, logged_list, start, end);
/*
* Some ordered extents started by fsync might have completed
* before we could collect them into the list logged_list, which
@@ -4204,7 +4204,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
* without writing to the log tree and the fsync must report the
* file data write error and not commit the current transaction.
*/
- ret = filemap_check_errors(inode->i_mapping);
+ ret = filemap_check_errors(inode->vfs_inode.i_mapping);
if (ret)
ctx->io_err = ret;
process:
@@ -4233,7 +4233,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
}
WARN_ON(!list_empty(&extents));
write_unlock(&tree->lock);
- up_write(&BTRFS_I(inode)->dio_sem);
+ up_write(&inode->dio_sem);
btrfs_release_path(path);
return ret;
@@ -4938,7 +4938,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto out_unlock;
}
if (fast_search) {
- ret = btrfs_log_changed_extents(trans, root, inode, dst_path,
+ ret = btrfs_log_changed_extents(trans, root, BTRFS_I(inode), dst_path,
&logged_list, ctx, start, end);
if (ret) {
err = ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 15/24] btrfs: Make log_dir_items take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (13 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 14/24] btrfs: Make btrfs_log_changed_extents " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 16/24] btrfs: Make log_directory_changes " Nikolay Borisov
` (9 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index e293ae0e18d7..8d7197a0eceb 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3260,7 +3260,7 @@ static noinline int insert_dir_log_key(struct btrfs_trans_handle *trans,
* to replay anything deleted before the fsync
*/
static noinline int log_dir_items(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct inode *inode,
+ struct btrfs_root *root, struct btrfs_inode *inode,
struct btrfs_path *path,
struct btrfs_path *dst_path, int key_type,
struct btrfs_log_ctx *ctx,
@@ -3275,7 +3275,7 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans,
int nritems;
u64 first_offset = min_offset;
u64 last_offset = (u64)-1;
- u64 ino = btrfs_ino(BTRFS_I(inode));
+ u64 ino = btrfs_ino(inode);
log = root->log_root;
@@ -3464,7 +3464,7 @@ static noinline int log_directory_changes(struct btrfs_trans_handle *trans,
min_key = 0;
max_key = 0;
while (1) {
- ret = log_dir_items(trans, root, inode, path,
+ ret = log_dir_items(trans, root, BTRFS_I(inode), path,
dst_path, key_type, ctx, min_key,
&max_key);
if (ret)
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 16/24] btrfs: Make log_directory_changes take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (14 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 15/24] btrfs: Make log_dir_items " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 17/24] btrfs: Make log_new_dir_dentries " Nikolay Borisov
` (8 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 8d7197a0eceb..38cda7869bf9 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3450,7 +3450,7 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans,
* key logged by this transaction.
*/
static noinline int log_directory_changes(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct inode *inode,
+ struct btrfs_root *root, struct btrfs_inode *inode,
struct btrfs_path *path,
struct btrfs_path *dst_path,
struct btrfs_log_ctx *ctx)
@@ -3464,9 +3464,8 @@ static noinline int log_directory_changes(struct btrfs_trans_handle *trans,
min_key = 0;
max_key = 0;
while (1) {
- ret = log_dir_items(trans, root, BTRFS_I(inode), path,
- dst_path, key_type, ctx, min_key,
- &max_key);
+ ret = log_dir_items(trans, root, inode, path, dst_path, key_type,
+ ctx, min_key, &max_key);
if (ret)
return ret;
if (max_key == (u64)-1)
@@ -4977,7 +4976,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
}
if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
- ret = log_directory_changes(trans, root, inode, path, dst_path,
+ ret = log_directory_changes(trans, root, BTRFS_I(inode), path, dst_path,
ctx);
if (ret) {
err = ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 17/24] btrfs: Make log_new_dir_dentries take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (15 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 16/24] btrfs: Make log_directory_changes " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 18/24] btrfs: Make btrfs_unlink_inode " Nikolay Borisov
` (7 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 38cda7869bf9..b0cc56fe86e9 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5155,7 +5155,7 @@ struct btrfs_dir_list {
*/
static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *start_inode,
+ struct btrfs_inode *start_inode,
struct btrfs_log_ctx *ctx)
{
struct btrfs_fs_info *fs_info = root->fs_info;
@@ -5174,7 +5174,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
btrfs_free_path(path);
return -ENOMEM;
}
- dir_elem->ino = btrfs_ino(BTRFS_I(start_inode));
+ dir_elem->ino = btrfs_ino(start_inode);
list_add_tail(&dir_elem->list, &dir_list);
while (!list_empty(&dir_list)) {
@@ -5368,7 +5368,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
ret = 1;
if (!ret && ctx && ctx->log_new_dentries)
ret = log_new_dir_dentries(trans, root,
- dir_inode, ctx);
+ BTRFS_I(dir_inode), ctx);
iput(dir_inode);
if (ret)
goto out;
@@ -5531,7 +5531,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
old_parent = parent;
}
if (log_dentries)
- ret = log_new_dir_dentries(trans, root, orig_inode, ctx);
+ ret = log_new_dir_dentries(trans, root, BTRFS_I(orig_inode), ctx);
else
ret = 0;
end_trans:
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 18/24] btrfs: Make btrfs_unlink_inode take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (16 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 17/24] btrfs: Make log_new_dir_dentries " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 19/24] btrfs: Make drop_one_dir_item " Nikolay Borisov
` (6 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/ctree.h | 2 +-
fs/btrfs/inode.c | 58 ++++++++++++++++++++++++++---------------------------
fs/btrfs/tree-log.c | 14 ++++++-------
3 files changed, 36 insertions(+), 38 deletions(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 6a823719b6c5..06d5e6388b4c 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3119,7 +3119,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry);
int btrfs_set_inode_index(struct inode *dir, u64 *index);
int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
const char *name, int name_len);
int btrfs_add_link(struct btrfs_trans_handle *trans,
struct inode *parent_inode, struct inode *inode,
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index e86b08eabb82..ac433c43d242 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3996,7 +3996,7 @@ noinline int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,
*/
static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
const char *name, int name_len)
{
struct btrfs_fs_info *fs_info = root->fs_info;
@@ -4006,8 +4006,8 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
struct btrfs_dir_item *di;
struct btrfs_key key;
u64 index;
- u64 ino = btrfs_ino(BTRFS_I(inode));
- u64 dir_ino = btrfs_ino(BTRFS_I(dir));
+ u64 ino = btrfs_ino(inode);
+ u64 dir_ino = btrfs_ino(dir);
path = btrfs_alloc_path();
if (!path) {
@@ -4043,10 +4043,10 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
* that we delay to delete it, and just do this deletion when
* we update the inode item.
*/
- if (BTRFS_I(inode)->dir_index) {
- ret = btrfs_delayed_delete_inode_ref(BTRFS_I(inode));
+ if (inode->dir_index) {
+ ret = btrfs_delayed_delete_inode_ref(inode);
if (!ret) {
- index = BTRFS_I(inode)->dir_index;
+ index = inode->dir_index;
goto skip_backref;
}
}
@@ -4061,21 +4061,19 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
goto err;
}
skip_backref:
- ret = btrfs_delete_delayed_dir_index(trans, fs_info, BTRFS_I(dir), index);
+ ret = btrfs_delete_delayed_dir_index(trans, fs_info, dir, index);
if (ret) {
btrfs_abort_transaction(trans, ret);
goto err;
}
- ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len,
- BTRFS_I(inode), dir_ino);
+ ret = btrfs_del_inode_ref_in_log(trans, root, name, name_len, inode, dir_ino);
if (ret != 0 && ret != -ENOENT) {
btrfs_abort_transaction(trans, ret);
goto err;
}
- ret = btrfs_del_dir_entries_in_log(trans, root, name, name_len,
- BTRFS_I(dir), index);
+ ret = btrfs_del_dir_entries_in_log(trans, root, name, name_len, dir, index);
if (ret == -ENOENT)
ret = 0;
else if (ret)
@@ -4085,26 +4083,26 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
if (ret)
goto out;
- btrfs_i_size_write(dir, dir->i_size - name_len * 2);
- inode_inc_iversion(inode);
- inode_inc_iversion(dir);
- inode->i_ctime = dir->i_mtime =
- dir->i_ctime = current_time(inode);
- ret = btrfs_update_inode(trans, root, dir);
+ btrfs_i_size_write(&dir->vfs_inode, dir->vfs_inode.i_size - name_len * 2);
+ inode_inc_iversion(&inode->vfs_inode);
+ inode_inc_iversion(&dir->vfs_inode);
+ inode->vfs_inode.i_ctime = dir->vfs_inode.i_mtime =
+ dir->vfs_inode.i_ctime = current_time(&inode->vfs_inode);
+ ret = btrfs_update_inode(trans, root, &dir->vfs_inode);
out:
return ret;
}
int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
const char *name, int name_len)
{
int ret;
ret = __btrfs_unlink_inode(trans, root, dir, inode, name, name_len);
if (!ret) {
- drop_nlink(inode);
- ret = btrfs_update_inode(trans, root, inode);
+ drop_nlink(&inode->vfs_inode);
+ ret = btrfs_update_inode(trans, root, &inode->vfs_inode);
}
return ret;
}
@@ -4144,7 +4142,7 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
btrfs_record_unlink_dir(trans, BTRFS_I(dir), BTRFS_I(d_inode(dentry)), 0);
- ret = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
+ ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir), BTRFS_I(d_inode(dentry)),
dentry->d_name.name, dentry->d_name.len);
if (ret)
goto out;
@@ -4274,7 +4272,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
last_unlink_trans = BTRFS_I(inode)->last_unlink_trans;
/* now the directory is empty */
- err = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
+ err = btrfs_unlink_inode(trans, root, BTRFS_I(dir), BTRFS_I(d_inode(dentry)),
dentry->d_name.name, dentry->d_name.len);
if (!err) {
btrfs_i_size_write(inode, 0);
@@ -9605,8 +9603,8 @@ static int btrfs_rename_exchange(struct inode *old_dir,
old_dentry->d_name.name,
old_dentry->d_name.len);
} else { /* src is an inode */
- ret = __btrfs_unlink_inode(trans, root, old_dir,
- old_dentry->d_inode,
+ ret = __btrfs_unlink_inode(trans, root, BTRFS_I(old_dir),
+ BTRFS_I(old_dentry->d_inode),
old_dentry->d_name.name,
old_dentry->d_name.len);
if (!ret)
@@ -9625,8 +9623,8 @@ static int btrfs_rename_exchange(struct inode *old_dir,
new_dentry->d_name.name,
new_dentry->d_name.len);
} else { /* dest is an inode */
- ret = __btrfs_unlink_inode(trans, dest, new_dir,
- new_dentry->d_inode,
+ ret = __btrfs_unlink_inode(trans, dest, BTRFS_I(new_dir),
+ BTRFS_I(new_dentry->d_inode),
new_dentry->d_name.name,
new_dentry->d_name.len);
if (!ret)
@@ -9881,8 +9879,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
old_dentry->d_name.name,
old_dentry->d_name.len);
} else {
- ret = __btrfs_unlink_inode(trans, root, old_dir,
- d_inode(old_dentry),
+ ret = __btrfs_unlink_inode(trans, root, BTRFS_I(old_dir),
+ BTRFS_I(d_inode(old_dentry)),
old_dentry->d_name.name,
old_dentry->d_name.len);
if (!ret)
@@ -9905,8 +9903,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
new_dentry->d_name.len);
BUG_ON(new_inode->i_nlink == 0);
} else {
- ret = btrfs_unlink_inode(trans, dest, new_dir,
- d_inode(new_dentry),
+ ret = btrfs_unlink_inode(trans, dest, BTRFS_I(new_dir),
+ BTRFS_I(d_inode(new_dentry)),
new_dentry->d_name.name,
new_dentry->d_name.len);
}
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index b0cc56fe86e9..b2c0a30811f6 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -875,7 +875,7 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
if (ret)
goto out;
- ret = btrfs_unlink_inode(trans, root, dir, inode, name, name_len);
+ ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir), BTRFS_I(inode), name, name_len);
if (ret)
goto out;
else
@@ -1050,8 +1050,8 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
inc_nlink(inode);
btrfs_release_path(path);
- ret = btrfs_unlink_inode(trans, root, dir,
- inode, victim_name,
+ ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir),
+ BTRFS_I(inode), victim_name,
victim_name_len);
kfree(victim_name);
if (ret)
@@ -1121,8 +1121,8 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
ret = btrfs_unlink_inode(trans, root,
- victim_parent,
- inode,
+ BTRFS_I(victim_parent),
+ BTRFS_I(inode),
victim_name,
victim_name_len);
if (!ret)
@@ -2052,8 +2052,8 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
}
inc_nlink(inode);
- ret = btrfs_unlink_inode(trans, root, dir, inode,
- name, name_len);
+ ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir),
+ BTRFS_I(inode), name, name_len);
if (!ret)
ret = btrfs_run_delayed_items(trans, fs_info);
kfree(name);
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 19/24] btrfs: Make drop_one_dir_item take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (17 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 18/24] btrfs: Make btrfs_unlink_inode " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 20/24] btrfs: Make __add_inode_ref " Nikolay Borisov
` (5 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index b2c0a30811f6..35434d686653 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -843,7 +843,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
- struct inode *dir,
+ struct btrfs_inode *dir,
struct btrfs_dir_item *di)
{
struct btrfs_fs_info *fs_info = root->fs_info;
@@ -875,7 +875,7 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
if (ret)
goto out;
- ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir), BTRFS_I(inode), name, name_len);
+ ret = btrfs_unlink_inode(trans, root, dir, BTRFS_I(inode), name, name_len);
if (ret)
goto out;
else
@@ -1151,7 +1151,7 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
ref_index, name, namelen, 0);
if (di && !IS_ERR(di)) {
- ret = drop_one_dir_item(trans, root, path, dir, di);
+ ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), di);
if (ret)
return ret;
}
@@ -1161,7 +1161,7 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
name, namelen, 0);
if (di && !IS_ERR(di)) {
- ret = drop_one_dir_item(trans, root, path, dir, di);
+ ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), di);
if (ret)
return ret;
}
@@ -1769,7 +1769,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
if (!exists)
goto out;
- ret = drop_one_dir_item(trans, root, path, dir, dst_di);
+ ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), dst_di);
if (ret)
goto out;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 20/24] btrfs: Make __add_inode_ref take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (18 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 19/24] btrfs: Make drop_one_dir_item " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 21/24] btrfs: Make log_inode_item " Nikolay Borisov
` (4 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 35434d686653..d919cd4252ba 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -991,7 +991,7 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
struct btrfs_root *log_root,
- struct inode *dir, struct inode *inode,
+ struct btrfs_inode *dir, struct btrfs_inode *inode,
struct extent_buffer *eb,
u64 inode_objectid, u64 parent_objectid,
u64 ref_index, char *name, int namelen,
@@ -1047,12 +1047,11 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
parent_objectid,
victim_name,
victim_name_len)) {
- inc_nlink(inode);
+ inc_nlink(&inode->vfs_inode);
btrfs_release_path(path);
- ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir),
- BTRFS_I(inode), victim_name,
- victim_name_len);
+ ret = btrfs_unlink_inode(trans, root, dir, inode,
+ victim_name, victim_name_len);
kfree(victim_name);
if (ret)
return ret;
@@ -1114,15 +1113,14 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
parent_objectid, victim_name,
victim_name_len)) {
ret = -ENOENT;
- victim_parent = read_one_inode(root,
- parent_objectid);
+ victim_parent = read_one_inode(root, parent_objectid);
if (victim_parent) {
- inc_nlink(inode);
+ inc_nlink(&inode->vfs_inode);
btrfs_release_path(path);
ret = btrfs_unlink_inode(trans, root,
BTRFS_I(victim_parent),
- BTRFS_I(inode),
+ inode,
victim_name,
victim_name_len);
if (!ret)
@@ -1148,20 +1146,20 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
/* look for a conflicting sequence number */
- di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
+ di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir),
ref_index, name, namelen, 0);
if (di && !IS_ERR(di)) {
- ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), di);
+ ret = drop_one_dir_item(trans, root, path, dir, di);
if (ret)
return ret;
}
btrfs_release_path(path);
/* look for a conflicing name */
- di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(BTRFS_I(dir)),
+ di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir),
name, namelen, 0);
if (di && !IS_ERR(di)) {
- ret = drop_one_dir_item(trans, root, path, BTRFS_I(dir), di);
+ ret = drop_one_dir_item(trans, root, path, dir, di);
if (ret)
return ret;
}
@@ -1307,7 +1305,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
if (!search_done) {
ret = __add_inode_ref(trans, root, path, log,
- dir, inode, eb,
+ BTRFS_I(dir), BTRFS_I(inode), eb,
inode_objectid,
parent_objectid,
ref_index, name, namelen,
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 21/24] btrfs: Make log_inode_item take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (19 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 20/24] btrfs: Make __add_inode_ref " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 22/24] btrfs: Make btrfs_log_inode " Nikolay Borisov
` (3 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index d919cd4252ba..1348ab5e3229 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3592,19 +3592,18 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
static int log_inode_item(struct btrfs_trans_handle *trans,
struct btrfs_root *log, struct btrfs_path *path,
- struct inode *inode)
+ struct btrfs_inode *inode)
{
struct btrfs_inode_item *inode_item;
int ret;
ret = btrfs_insert_empty_item(trans, log, path,
- &BTRFS_I(inode)->location,
- sizeof(*inode_item));
+ &inode->location, sizeof(*inode_item));
if (ret && ret != -EEXIST)
return ret;
inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_inode_item);
- fill_inode_item(trans, path->nodes[0], inode_item, inode, 0, 0);
+ fill_inode_item(trans, path->nodes[0], inode_item, &inode->vfs_inode, 0, 0);
btrfs_release_path(path);
return 0;
}
@@ -4930,7 +4929,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
btrfs_release_path(dst_path);
if (need_log_inode_item) {
- err = log_inode_item(trans, log, dst_path, inode);
+ err = log_inode_item(trans, log, dst_path, BTRFS_I(inode));
if (err)
goto out_unlock;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 22/24] btrfs: Make btrfs_log_inode take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (20 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 21/24] btrfs: Make log_inode_item " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 23/24] btrfs: Make count_inode_extrefs " Nikolay Borisov
` (2 subsequent siblings)
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 92 ++++++++++++++++++++++++++---------------------------
1 file changed, 45 insertions(+), 47 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 1348ab5e3229..8c110d0e16c3 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -97,7 +97,7 @@
#define LOG_WALK_REPLAY_ALL 3
static int btrfs_log_inode(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct inode *inode,
+ struct btrfs_root *root, struct btrfs_inode *inode,
int inode_only,
const loff_t start,
const loff_t end,
@@ -4589,7 +4589,7 @@ static int btrfs_check_ref_name_override(struct extent_buffer *eb,
* This handles both files and directories.
*/
static int btrfs_log_inode(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct inode *inode,
+ struct btrfs_root *root, struct btrfs_inode *inode,
int inode_only,
const loff_t start,
const loff_t end,
@@ -4610,8 +4610,8 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
int ins_start_slot = 0;
int ins_nr;
bool fast_search = false;
- u64 ino = btrfs_ino(BTRFS_I(inode));
- struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
+ u64 ino = btrfs_ino(inode);
+ struct extent_map_tree *em_tree = &inode->extent_tree;
u64 logged_isize = 0;
bool need_log_inode_item = true;
@@ -4632,10 +4632,10 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
/* today the code can only do partial logging of directories */
- if (S_ISDIR(inode->i_mode) ||
+ if (S_ISDIR(inode->vfs_inode.i_mode) ||
(!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
- &BTRFS_I(inode)->runtime_flags) &&
- inode_only >= LOG_INODE_EXISTS))
+ &inode->runtime_flags) &&
+ inode_only == LOG_INODE_EXISTS))
max_key.type = BTRFS_XATTR_ITEM_KEY;
else
max_key.type = (u8)-1;
@@ -4647,11 +4647,11 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* order for the log replay code to mark inodes for link count
* fixup (create temporary BTRFS_TREE_LOG_FIXUP_OBJECTID items).
*/
- if (S_ISDIR(inode->i_mode) ||
- BTRFS_I(inode)->generation > fs_info->last_trans_committed)
- ret = btrfs_commit_inode_delayed_items(trans, BTRFS_I(inode));
+ if (S_ISDIR(inode->vfs_inode.i_mode) ||
+ inode->generation > fs_info->last_trans_committed)
+ ret = btrfs_commit_inode_delayed_items(trans, inode);
else
- ret = btrfs_commit_inode_delayed_inode(BTRFS_I(inode));
+ ret = btrfs_commit_inode_delayed_inode(inode);
if (ret) {
btrfs_free_path(path);
@@ -4661,17 +4661,16 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
if (inode_only == LOG_OTHER_INODE) {
inode_only = LOG_INODE_EXISTS;
- mutex_lock_nested(&BTRFS_I(inode)->log_mutex,
- SINGLE_DEPTH_NESTING);
+ mutex_lock_nested(&inode->log_mutex, SINGLE_DEPTH_NESTING);
} else {
- mutex_lock(&BTRFS_I(inode)->log_mutex);
+ mutex_lock(&inode->log_mutex);
}
/*
* a brute force approach to making sure we get the most uptodate
* copies of everything.
*/
- if (S_ISDIR(inode->i_mode)) {
+ if (S_ISDIR(inode->vfs_inode.i_mode)) {
int max_key_type = BTRFS_DIR_LOG_INDEX_KEY;
if (inode_only == LOG_INODE_EXISTS)
@@ -4692,31 +4691,30 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* (zeroes), as if an expanding truncate happened,
* instead of getting a file of 4Kb only.
*/
- err = logged_inode_size(log, BTRFS_I(inode), path,
- &logged_isize);
+ err = logged_inode_size(log, inode, path, &logged_isize);
if (err)
goto out_unlock;
}
if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
- &BTRFS_I(inode)->runtime_flags)) {
+ &inode->runtime_flags)) {
if (inode_only == LOG_INODE_EXISTS) {
max_key.type = BTRFS_XATTR_ITEM_KEY;
ret = drop_objectid_items(trans, log, path, ino,
max_key.type);
} else {
clear_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
- &BTRFS_I(inode)->runtime_flags);
+ &inode->runtime_flags);
clear_bit(BTRFS_INODE_COPY_EVERYTHING,
- &BTRFS_I(inode)->runtime_flags);
+ &inode->runtime_flags);
while(1) {
ret = btrfs_truncate_inode_items(trans,
- log, inode, 0, 0);
+ log, &inode->vfs_inode, 0, 0);
if (ret != -EAGAIN)
break;
}
}
} else if (test_and_clear_bit(BTRFS_INODE_COPY_EVERYTHING,
- &BTRFS_I(inode)->runtime_flags) ||
+ &inode->runtime_flags) ||
inode_only == LOG_INODE_EXISTS) {
if (inode_only == LOG_INODE_ALL)
fast_search = true;
@@ -4757,13 +4755,12 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
if ((min_key.type == BTRFS_INODE_REF_KEY ||
min_key.type == BTRFS_INODE_EXTREF_KEY) &&
- BTRFS_I(inode)->generation == trans->transid) {
+ inode->generation == trans->transid) {
u64 other_ino = 0;
ret = btrfs_check_ref_name_override(path->nodes[0],
- path->slots[0],
- &min_key, BTRFS_I(inode),
- &other_ino);
+ path->slots[0], &min_key, inode,
+ &other_ino);
if (ret < 0) {
err = ret;
goto out_unlock;
@@ -4778,7 +4775,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
ins_nr = 1;
ins_start_slot = path->slots[0];
}
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
+ ret = copy_items(trans, inode, dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only,
logged_isize);
@@ -4816,7 +4813,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* update the log with the new name before we
* unpin it.
*/
- err = btrfs_log_inode(trans, root, other_inode,
+ err = btrfs_log_inode(trans, root, BTRFS_I(other_inode),
LOG_OTHER_INODE,
0, LLONG_MAX, ctx);
iput(other_inode);
@@ -4831,7 +4828,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
if (min_key.type == BTRFS_XATTR_ITEM_KEY) {
if (ins_nr == 0)
goto next_slot;
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
+ ret = copy_items(trans, inode, dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only, logged_isize);
if (ret < 0) {
@@ -4856,7 +4853,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto next_slot;
}
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent,
+ ret = copy_items(trans, inode, dst_path, path, &last_extent,
ins_start_slot, ins_nr, inode_only,
logged_isize);
if (ret < 0) {
@@ -4880,7 +4877,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto again;
}
if (ins_nr) {
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path,
+ ret = copy_items(trans, inode, dst_path, path,
&last_extent, ins_start_slot,
ins_nr, inode_only, logged_isize);
if (ret < 0) {
@@ -4902,7 +4899,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
}
}
if (ins_nr) {
- ret = copy_items(trans, BTRFS_I(inode), dst_path, path, &last_extent,
+ ret = copy_items(trans, inode, dst_path, path, &last_extent,
ins_start_slot, ins_nr, inode_only,
logged_isize);
if (ret < 0) {
@@ -4915,13 +4912,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
btrfs_release_path(dst_path);
- err = btrfs_log_all_xattrs(trans, root, BTRFS_I(inode), path, dst_path);
+ err = btrfs_log_all_xattrs(trans, root, inode, path, dst_path);
if (err)
goto out_unlock;
if (max_key.type >= BTRFS_EXTENT_DATA_KEY && !fast_search) {
btrfs_release_path(path);
btrfs_release_path(dst_path);
- err = btrfs_log_trailing_hole(trans, root, BTRFS_I(inode), path);
+ err = btrfs_log_trailing_hole(trans, root, inode, path);
if (err)
goto out_unlock;
}
@@ -4929,12 +4926,12 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
btrfs_release_path(dst_path);
if (need_log_inode_item) {
- err = log_inode_item(trans, log, dst_path, BTRFS_I(inode));
+ err = log_inode_item(trans, log, dst_path, inode);
if (err)
goto out_unlock;
}
if (fast_search) {
- ret = btrfs_log_changed_extents(trans, root, BTRFS_I(inode), dst_path,
+ ret = btrfs_log_changed_extents(trans, root, inode, dst_path,
&logged_list, ctx, start, end);
if (ret) {
err = ret;
@@ -4972,8 +4969,8 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
write_unlock(&em_tree->lock);
}
- if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
- ret = log_directory_changes(trans, root, BTRFS_I(inode), path, dst_path,
+ if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->vfs_inode.i_mode)) {
+ ret = log_directory_changes(trans, root, inode, path, dst_path,
ctx);
if (ret) {
err = ret;
@@ -4981,16 +4978,16 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
}
}
- spin_lock(&BTRFS_I(inode)->lock);
- BTRFS_I(inode)->logged_trans = trans->transid;
- BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans;
- spin_unlock(&BTRFS_I(inode)->lock);
+ spin_lock(&inode->lock);
+ inode->logged_trans = trans->transid;
+ inode->last_log_commit = inode->last_sub_trans;
+ spin_unlock(&inode->lock);
out_unlock:
if (unlikely(err))
btrfs_put_logged_extents(&logged_list);
else
btrfs_submit_logged_extents(&logged_list, log);
- mutex_unlock(&BTRFS_I(inode)->log_mutex);
+ mutex_unlock(&inode->log_mutex);
btrfs_free_path(path);
btrfs_free_path(dst_path);
@@ -5238,7 +5235,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
ctx->log_new_dentries = false;
if (type == BTRFS_FT_DIR || type == BTRFS_FT_SYMLINK)
log_mode = LOG_INODE_ALL;
- ret = btrfs_log_inode(trans, root, di_inode,
+ ret = btrfs_log_inode(trans, root, BTRFS_I(di_inode),
log_mode, 0, LLONG_MAX, ctx);
if (!ret &&
btrfs_must_commit_transaction(trans, BTRFS_I(di_inode)))
@@ -5358,7 +5355,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
if (ctx)
ctx->log_new_dentries = false;
- ret = btrfs_log_inode(trans, root, dir_inode,
+ ret = btrfs_log_inode(trans, root, BTRFS_I(dir_inode),
LOG_INODE_ALL, 0, LLONG_MAX, ctx);
if (!ret &&
btrfs_must_commit_transaction(trans, BTRFS_I(dir_inode)))
@@ -5438,7 +5435,8 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
if (ret)
goto end_no_trans;
- ret = btrfs_log_inode(trans, root, inode, inode_only, start, end, ctx);
+ ret = btrfs_log_inode(trans, root, BTRFS_I(inode), inode_only,
+ start, end, ctx);
if (ret)
goto end_trans;
@@ -5514,7 +5512,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
break;
if (BTRFS_I(inode)->generation > last_committed) {
- ret = btrfs_log_inode(trans, root, inode,
+ ret = btrfs_log_inode(trans, root, BTRFS_I(inode),
LOG_INODE_EXISTS,
0, LLONG_MAX, ctx);
if (ret)
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 23/24] btrfs: Make count_inode_extrefs take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (21 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 22/24] btrfs: Make btrfs_log_inode " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 24/24] btrfs: Make count_inode_refs " Nikolay Borisov
2017-01-19 18:21 ` [PATCHv2 00/24] tree-log inode vs btrfs_inode cleanups David Sterba
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 8c110d0e16c3..47e4f3610348 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1358,14 +1358,14 @@ static int insert_orphan_item(struct btrfs_trans_handle *trans,
}
static int count_inode_extrefs(struct btrfs_root *root,
- struct inode *inode, struct btrfs_path *path)
+ struct btrfs_inode *inode, struct btrfs_path *path)
{
int ret = 0;
int name_len;
unsigned int nlink = 0;
u32 item_size;
u32 cur_offset = 0;
- u64 inode_objectid = btrfs_ino(BTRFS_I(inode));
+ u64 inode_objectid = btrfs_ino(inode);
u64 offset = 0;
unsigned long ptr;
struct btrfs_inode_extref *extref;
@@ -1487,7 +1487,7 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
nlink = ret;
- ret = count_inode_extrefs(root, inode, path);
+ ret = count_inode_extrefs(root, BTRFS_I(inode), path);
if (ret < 0)
goto out;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCHv2 24/24] btrfs: Make count_inode_refs take btrfs_inode
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (22 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 23/24] btrfs: Make count_inode_extrefs " Nikolay Borisov
@ 2017-01-17 22:31 ` Nikolay Borisov
2017-01-19 18:21 ` [PATCHv2 00/24] tree-log inode vs btrfs_inode cleanups David Sterba
24 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-17 22:31 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, Nikolay Borisov
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
---
fs/btrfs/tree-log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 47e4f3610348..a16da4a3ab63 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1402,7 +1402,7 @@ static int count_inode_extrefs(struct btrfs_root *root,
}
static int count_inode_refs(struct btrfs_root *root,
- struct inode *inode, struct btrfs_path *path)
+ struct btrfs_inode *inode, struct btrfs_path *path)
{
int ret;
struct btrfs_key key;
@@ -1410,7 +1410,7 @@ static int count_inode_refs(struct btrfs_root *root,
unsigned long ptr;
unsigned long ptr_end;
int name_len;
- u64 ino = btrfs_ino(BTRFS_I(inode));
+ u64 ino = btrfs_ino(inode);
key.objectid = ino;
key.type = BTRFS_INODE_REF_KEY;
@@ -1481,7 +1481,7 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
if (!path)
return -ENOMEM;
- ret = count_inode_refs(root, inode, path);
+ ret = count_inode_refs(root, BTRFS_I(inode), path);
if (ret < 0)
goto out;
--
2.7.4
^ permalink raw reply related [flat|nested] 53+ messages in thread
* Re: [PATCHv2 00/24] tree-log inode vs btrfs_inode cleanups
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
` (23 preceding siblings ...)
2017-01-17 22:31 ` [PATCHv2 24/24] btrfs: Make count_inode_refs " Nikolay Borisov
@ 2017-01-19 18:21 ` David Sterba
2017-01-20 7:22 ` Nikolay Borisov
24 siblings, 1 reply; 53+ messages in thread
From: David Sterba @ 2017-01-19 18:21 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: dsterba, linux-btrfs
On Wed, Jan 18, 2017 at 12:31:26AM +0200, Nikolay Borisov wrote:
> So here is a new set of patches cleaning up tree-log function
> w.r.t inode vs btrfs_inode. There are still some which remain
> but I didn't find compelling arguments to cleaning them up, so
> I've left them unchanged. This time there are some size shrinkage:
>
> text data bss dec hex filename
> 2530598 174661 28288 2733547 29b5eb fs/btrfs/btrfs.ko - upstream master
>
> text data bss dec hex filename
> 2530774 174661 28288 2733723 29b69b fs/btrfs/btrfs.ko - before tree-log cleanup
>
> text data bss dec hex filename
> 2530163 174661 28288 2733112 29b438 fs/btrfs/btrfs.ko - both series applied
>
> So the net result of the 2 series is 435 bytes and I assume there
> will be further reduction in size once further cleanups are made
>
> Changes since v1:
> * Rebased all patche to latest master
>
> Nikolay Borisov (24):
> btrfs: Make btrfs_must_commit_transaction take btrfs_inode
> btrfs: Make btrfs_record_unlink_dir take btrfs_inode
> btrfs: Make btrfs_record_snapshot_destroy take btrfs_inode
> btrfs: Make btrfs_inode_in_log take btrfs_inode
> btrfs: Make btrfs_log_new_name take btrfs_inode
> btrfs: Make btrfs_del_dir_entries_in_log take btrfs_inode
> btrfs: Make btrfs_del_inode_ref take btrfs_inode
> btrfs: Make logged_inode_size take btrfs_inode
> btrfs: Make btrfs_check_ref_name_override take btrfs_inode
> btrfs: Make copy_items take btrfs_inode
> btrfs: Make btrfs_log_all_xattrs take btrfs_inode
> btrfs: Make btrfs_log_trailing_hole take btrfs_inode
> btrfs: Make btrfs_get_logged_extents take btrfs_inode
> btrfs: Make btrfs_log_changed_extents take btrfs_inode
> btrfs: Make log_dir_items take btrfs_inode
> btrfs: Make log_directory_changes take btrfs_inode
> btrfs: Make log_new_dir_dentries take btrfs_inode
> btrfs: Make btrfs_unlink_inode take btrfs_inode
> btrfs: Make drop_one_dir_item take btrfs_inode
> btrfs: Make __add_inode_ref take btrfs_inode
> btrfs: Make log_inode_item take btrfs_inode
> btrfs: Make btrfs_log_inode take btrfs_inode
> btrfs: Make count_inode_extrefs take btrfs_inode
> btrfs: Make count_inode_refs take btrfs_inode
Added to 4.11 queue, thanks. There were several 80+ lines added by the
patches, I've updated the patches during review. Please be more careful
with changes like this
>From https://patchwork.kernel.org/patch/9522051/
- if (S_ISDIR(inode->i_mode) ||
+ if (S_ISDIR(inode->vfs_inode.i_mode) ||
(!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
- &BTRFS_I(inode)->runtime_flags) &&
- inode_only >= LOG_INODE_EXISTS))
+ &inode->runtime_flags) &&
+ inode_only == LOG_INODE_EXISTS))
Notice the change from >= to == .
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCHv2 00/24] tree-log inode vs btrfs_inode cleanups
2017-01-19 18:21 ` [PATCHv2 00/24] tree-log inode vs btrfs_inode cleanups David Sterba
@ 2017-01-20 7:22 ` Nikolay Borisov
0 siblings, 0 replies; 53+ messages in thread
From: Nikolay Borisov @ 2017-01-20 7:22 UTC (permalink / raw)
To: dsterba, linux-btrfs
On 19.01.2017 20:21, David Sterba wrote:
> On Wed, Jan 18, 2017 at 12:31:26AM +0200, Nikolay Borisov wrote:
>> So here is a new set of patches cleaning up tree-log function
>> w.r.t inode vs btrfs_inode. There are still some which remain
>> but I didn't find compelling arguments to cleaning them up, so
>> I've left them unchanged. This time there are some size shrinkage:
>>
>> text data bss dec hex filename
>> 2530598 174661 28288 2733547 29b5eb fs/btrfs/btrfs.ko - upstream master
>>
>> text data bss dec hex filename
>> 2530774 174661 28288 2733723 29b69b fs/btrfs/btrfs.ko - before tree-log cleanup
>>
>> text data bss dec hex filename
>> 2530163 174661 28288 2733112 29b438 fs/btrfs/btrfs.ko - both series applied
>>
>> So the net result of the 2 series is 435 bytes and I assume there
>> will be further reduction in size once further cleanups are made
>>
>> Changes since v1:
>> * Rebased all patche to latest master
>>
>> Nikolay Borisov (24):
>> btrfs: Make btrfs_must_commit_transaction take btrfs_inode
>> btrfs: Make btrfs_record_unlink_dir take btrfs_inode
>> btrfs: Make btrfs_record_snapshot_destroy take btrfs_inode
>> btrfs: Make btrfs_inode_in_log take btrfs_inode
>> btrfs: Make btrfs_log_new_name take btrfs_inode
>> btrfs: Make btrfs_del_dir_entries_in_log take btrfs_inode
>> btrfs: Make btrfs_del_inode_ref take btrfs_inode
>> btrfs: Make logged_inode_size take btrfs_inode
>> btrfs: Make btrfs_check_ref_name_override take btrfs_inode
>> btrfs: Make copy_items take btrfs_inode
>> btrfs: Make btrfs_log_all_xattrs take btrfs_inode
>> btrfs: Make btrfs_log_trailing_hole take btrfs_inode
>> btrfs: Make btrfs_get_logged_extents take btrfs_inode
>> btrfs: Make btrfs_log_changed_extents take btrfs_inode
>> btrfs: Make log_dir_items take btrfs_inode
>> btrfs: Make log_directory_changes take btrfs_inode
>> btrfs: Make log_new_dir_dentries take btrfs_inode
>> btrfs: Make btrfs_unlink_inode take btrfs_inode
>> btrfs: Make drop_one_dir_item take btrfs_inode
>> btrfs: Make __add_inode_ref take btrfs_inode
>> btrfs: Make log_inode_item take btrfs_inode
>> btrfs: Make btrfs_log_inode take btrfs_inode
>> btrfs: Make count_inode_extrefs take btrfs_inode
>> btrfs: Make count_inode_refs take btrfs_inode
>
> Added to 4.11 queue, thanks. There were several 80+ lines added by the
> patches, I've updated the patches during review. Please be more careful
> with changes like this
>
> From https://patchwork.kernel.org/patch/9522051/
>
> - if (S_ISDIR(inode->i_mode) ||
> + if (S_ISDIR(inode->vfs_inode.i_mode) ||
> (!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
> - &BTRFS_I(inode)->runtime_flags) &&
> - inode_only >= LOG_INODE_EXISTS))
> + &inode->runtime_flags) &&
> + inode_only == LOG_INODE_EXISTS))
>
> Notice the change from >= to == .
Yeah, I did notice this after the rebase I did when you told me patch 6
wasn't applying cleanly, however I thought I had fixed it during the
rebase. Apparently I do need to recheck things one more time for good
measure.
Anyway, thanks for pulling!
^ permalink raw reply [flat|nested] 53+ messages in thread
end of thread, other threads:[~2017-01-20 7:23 UTC | newest]
Thread overview: 53+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-12 14:00 [PATCH 00/24] tree-log inode vs btrfs_inode cleanups Nikolay Borisov
2017-01-12 14:00 ` [PATCH 01/24] btrfs: Make btrfs_must_commit_transaction take btrfs_inode Nikolay Borisov
2017-01-12 14:00 ` [PATCH 02/24] btrfs: Make btrfs_record_unlink_dir " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 03/24] btrfs: Make btrfs_record_snapshot_destroy " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 04/24] btrfs: Make btrfs_inode_in_log " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 05/24] btrfs: Make btrfs_log_new_name " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 06/24] btrfs: Make btrfs_del_dir_entries_in_log " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 07/24] btrfs: Make btrfs_del_inode_ref " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 08/24] btrfs: Make logged_inode_size " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 09/24] btrfs: Make btrfs_check_ref_name_override " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 10/24] btrfs: Make copy_items " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 11/24] btrfs: Make btrfs_log_all_xattrs " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 12/24] btrfs: Make btrfs_log_trailing_hole " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 13/24] btrfs: Make btrfs_get_logged_extents " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 14/24] btrfs: Make btrfs_log_changed_extents " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 15/24] btrfs: Make log_dir_items " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 16/24] btrfs: Make log_directory_changes " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 17/24] btrfs: Make log_new_dir_dentries " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 18/24] btrfs: Make btrfs_unlink_inode " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 19/24] btrfs: Make drop_one_dir_item " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 20/24] btrfs: Make __add_inode_ref " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 21/24] btrfs: Make log_inode_item " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 22/24] btrfs: Make btrfs_log_inode " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 23/24] btrfs: Make count_inode_extrefs " Nikolay Borisov
2017-01-12 14:00 ` [PATCH 24/24] btrfs: Make count_inode_refs " Nikolay Borisov
2017-01-17 16:15 ` [PATCH 00/24] tree-log inode vs btrfs_inode cleanups David Sterba
2017-01-17 22:31 ` [PATCHv2 " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 01/24] btrfs: Make btrfs_must_commit_transaction take btrfs_inode Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 02/24] btrfs: Make btrfs_record_unlink_dir " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 03/24] btrfs: Make btrfs_record_snapshot_destroy " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 04/24] btrfs: Make btrfs_inode_in_log " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 05/24] btrfs: Make btrfs_log_new_name " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 06/24] btrfs: Make btrfs_del_dir_entries_in_log " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 07/24] btrfs: Make btrfs_del_inode_ref " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 08/24] btrfs: Make logged_inode_size " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 09/24] btrfs: Make btrfs_check_ref_name_override " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 10/24] btrfs: Make copy_items " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 11/24] btrfs: Make btrfs_log_all_xattrs " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 12/24] btrfs: Make btrfs_log_trailing_hole " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 13/24] btrfs: Make btrfs_get_logged_extents " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 14/24] btrfs: Make btrfs_log_changed_extents " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 15/24] btrfs: Make log_dir_items " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 16/24] btrfs: Make log_directory_changes " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 17/24] btrfs: Make log_new_dir_dentries " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 18/24] btrfs: Make btrfs_unlink_inode " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 19/24] btrfs: Make drop_one_dir_item " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 20/24] btrfs: Make __add_inode_ref " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 21/24] btrfs: Make log_inode_item " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 22/24] btrfs: Make btrfs_log_inode " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 23/24] btrfs: Make count_inode_extrefs " Nikolay Borisov
2017-01-17 22:31 ` [PATCHv2 24/24] btrfs: Make count_inode_refs " Nikolay Borisov
2017-01-19 18:21 ` [PATCHv2 00/24] tree-log inode vs btrfs_inode cleanups David Sterba
2017-01-20 7:22 ` Nikolay Borisov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).