From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 3/4 v2] f2fs: record node block allocation in dnode_of_data
Date: Wed, 23 Dec 2015 11:00:17 -0800 [thread overview]
Message-ID: <20151223190017.GC30505@jaegeuk.local> (raw)
In-Reply-To: <1450832388-29118-3-git-send-email-jaegeuk@kernel.org>
Change log from v1:
- remove redundant set
- adjust memory alignment
>From 60c6a898094535e850268dd77701255a37cce3d3 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@kernel.org>
Date: Tue, 22 Dec 2015 12:59:54 -0800
Subject: [PATCH] f2fs: record node block allocation in dnode_of_data
This patch introduces recording node block allocation in dnode_of_data.
This information helps to figure out whether any node block is allocated during
specific file operations.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/data.c | 1 +
fs/f2fs/f2fs.h | 1 +
fs/f2fs/node.c | 4 ++++
3 files changed, 6 insertions(+)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index cf0c9dd..a7a9a05 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -226,6 +226,7 @@ void set_data_blkaddr(struct dnode_of_data *dn)
addr_array = blkaddr_in_node(rn);
addr_array[ofs_in_node] = cpu_to_le32(dn->data_blkaddr);
set_page_dirty(node_page);
+ dn->node_changed = true;
}
int reserve_new_block(struct dnode_of_data *dn)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 90fb970..3e4a60d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -546,6 +546,7 @@ struct dnode_of_data {
nid_t nid; /* node id of the direct node block */
unsigned int ofs_in_node; /* data offset in the node page */
bool inode_page_locked; /* inode page is locked or not */
+ bool node_changed; /* is node block changed */
block_t data_blkaddr; /* block address of the node block */
};
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 6cc8ac7..ff2acb1 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -542,6 +542,7 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
set_nid(parent, offset[i - 1], nids[i], i == 1);
alloc_nid_done(sbi, nids[i]);
+ dn->node_changed = true;
done = true;
} else if (mode == LOOKUP_NODE_RA && i == level && level > 1) {
npage[i] = get_node_page_ra(parent, offset[i - 1]);
@@ -678,6 +679,7 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs,
if (ret < 0)
goto out_err;
set_nid(page, i, 0, false);
+ dn->node_changed = true;
}
} else {
child_nofs = nofs + ofs * (NIDS_PER_BLOCK + 1) + 1;
@@ -691,6 +693,7 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs,
ret = truncate_nodes(&rdn, child_nofs, 0, depth - 1);
if (ret == (NIDS_PER_BLOCK + 1)) {
set_nid(page, i, 0, false);
+ dn->node_changed = true;
child_nofs += ret;
} else if (ret < 0 && ret != -ENOENT) {
goto out_err;
@@ -752,6 +755,7 @@ static int truncate_partial_nodes(struct dnode_of_data *dn,
if (err < 0)
goto fail;
set_nid(pages[idx], i, 0, false);
+ dn->node_changed = true;
}
if (offset[idx + 1] == 0) {
--
2.5.4 (Apple Git-61)
next prev parent reply other threads:[~2015-12-23 19:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-23 0:59 [PATCH 1/4] f2fs: check inline_data flag at converting time Jaegeuk Kim
2015-12-23 0:59 ` [PATCH 2/4] f2fs: avoid unnecessary f2fs_gc for dir operations Jaegeuk Kim
2015-12-23 3:26 ` [f2fs-dev] " Chao Yu
2015-12-23 18:54 ` [f2fs-dev] [PATCH 2/4 v2] " Jaegeuk Kim
2015-12-24 1:32 ` Chao Yu
2015-12-24 2:13 ` Jaegeuk Kim
2015-12-24 3:30 ` Chao Yu
2015-12-23 0:59 ` [PATCH 3/4] f2fs: record node block allocation in dnode_of_data Jaegeuk Kim
2015-12-23 8:00 ` [f2fs-dev] " Chao Yu
2015-12-23 18:57 ` Jaegeuk Kim
2015-12-23 19:00 ` Jaegeuk Kim [this message]
2015-12-24 1:35 ` [f2fs-dev] [PATCH 3/4 v2] " Chao Yu
2015-12-23 0:59 ` [PATCH 4/4] f2fs: call f2fs_balance_fs only when node was changed Jaegeuk Kim
2015-12-23 9:46 ` [f2fs-dev] " Chao Yu
2015-12-23 19:13 ` Jaegeuk Kim
2015-12-25 1:38 ` Chao Yu
2015-12-23 19:14 ` Jaegeuk Kim
2015-12-24 5:48 ` [f2fs-dev] " Chao Yu
2015-12-23 3:19 ` [f2fs-dev] [PATCH 1/4] f2fs: check inline_data flag at converting time Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151223190017.GC30505@jaegeuk.local \
--to=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).