From: amir73il@users.sourceforge.net
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, Amir Goldstein <amir73il@users.sf.net>
Subject: [PATCH 1/4] ext4: split ext4_ind_truncate from ext4_truncate
Date: Tue, 21 Jun 2011 12:39:25 +0300 [thread overview]
Message-ID: <1308649168-12543-2-git-send-email-amir73il@users.sourceforge.net> (raw)
In-Reply-To: <1308649168-12543-1-git-send-email-amir73il@users.sourceforge.net>
From: Amir Goldstein <amir73il@users.sf.net>
We are about to move all indirect inode functions to a new file.
Before we do that, let's split ext4_ind_truncate() out of ext4_truncate()
leaving only generic code in the latter, so we will be able to move
ext4_ind_truncate() to the new file.
Signed-off-by: Amir Goldstein <amir73il@users.sf.net>
---
fs/ext4/ext4.h | 2 ++
fs/ext4/inode.c | 36 ++++++++++++++++++++----------------
2 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 1921392..8532dd4 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1834,6 +1834,8 @@ extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
extern qsize_t *ext4_get_reserved_space(struct inode *inode);
extern void ext4_da_update_reserve_space(struct inode *inode,
int used, int quota_claim);
+extern void ext4_ind_truncate(struct inode *inode);
+
/* ioctl.c */
extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index a5763e3..2bb7102 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4471,6 +4471,26 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
*/
void ext4_truncate(struct inode *inode)
{
+ trace_ext4_truncate_enter(inode);
+
+ if (!ext4_can_truncate(inode))
+ return;
+
+ ext4_clear_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
+
+ if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC))
+ ext4_set_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
+
+ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
+ ext4_ext_truncate(inode);
+ else
+ ext4_ind_truncate(inode);
+
+ trace_ext4_truncate_exit(inode);
+}
+
+void ext4_ind_truncate(struct inode *inode)
+{
handle_t *handle;
struct ext4_inode_info *ei = EXT4_I(inode);
__le32 *i_data = ei->i_data;
@@ -4484,22 +4504,6 @@ void ext4_truncate(struct inode *inode)
ext4_lblk_t last_block, max_block;
unsigned blocksize = inode->i_sb->s_blocksize;
- trace_ext4_truncate_enter(inode);
-
- if (!ext4_can_truncate(inode))
- return;
-
- ext4_clear_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
-
- if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC))
- ext4_set_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
-
- if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
- ext4_ext_truncate(inode);
- trace_ext4_truncate_exit(inode);
- return;
- }
next prev parent reply other threads:[~2011-06-21 9:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-21 9:39 [PATCH 0/4] ext4: reduce the size of inode.c amir73il
2011-06-21 9:39 ` amir73il [this message]
2011-06-21 9:39 ` [PATCH 2/4] ext4: rename ext4_indirect_* funcs to ext4_ind_* amir73il
2011-06-21 9:39 ` [PATCH 3/4] ext4: clone indirect.c file from inode.c amir73il
2011-06-27 23:41 ` Ted Ts'o
2011-06-27 23:44 ` [PATCH 1/3] ext4: move __ext4_check_blockref to block_validity.c Theodore Ts'o
2011-06-27 23:44 ` [PATCH 2/3] ext4: move common truncate functions to header file Theodore Ts'o
2011-06-27 23:44 ` [PATCH 3/3] ext4: move ext4_ind_* functions from inode.c to indirect.c Theodore Ts'o
2011-06-28 7:02 ` [PATCH 3/4] ext4: clone indirect.c file from inode.c Amir G.
2011-06-21 9:39 ` [PATCH 4/4] ext4: move ext4_ind_* functions from inode.c to indirect.c amir73il
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=1308649168-12543-2-git-send-email-amir73il@users.sourceforge.net \
--to=amir73il@users.sourceforge.net \
--cc=amir73il@users.sf.net \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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).