From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] ext4: Only write journal entries for modified blocks in unlink_filename
Date: Fri, 14 Oct 2016 12:31:44 +0200 [thread overview]
Message-ID: <20161014123144.6940ad87@amdc2363> (raw)
In-Reply-To: <39ee93036b7148048f17cee26fbfe4c6@rwthex-w2-b.rwth-ad.de>
Hi Stefan,
> Instead of creating a journal entry for each directory block, even
> if the block is unmodified, only log the modified block.
>
> Signed-off-by: Stefan Br?ns <stefan.bruens@rwth-aachen.de>
> ---
> fs/ext4/ext4_common.c | 23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
> index 11be0b7..ec02eec 100644
> --- a/fs/ext4/ext4_common.c
> +++ b/fs/ext4/ext4_common.c
> @@ -874,8 +874,6 @@ static int unlink_filename(char *filename,
> unsigned int blknr) if (status == 0)
> goto fail;
>
> - if (ext4fs_log_journal(block_buffer, blknr))
> - goto fail;
> offset = 0;
> do {
> previous_dir = dir;
> @@ -889,14 +887,6 @@ static int unlink_filename(char *filename,
> unsigned int blknr) if (dir->inode && (strlen(filename) ==
> dir->namelen) && (strncmp(direntname, filename, dir->namelen) == 0)) {
> inodeno = le32_to_cpu(dir->inode);
> - if (previous_dir) {
> - uint16_t new_len;
> - new_len =
> le16_to_cpu(previous_dir->direntlen);
> - new_len +=
> le16_to_cpu(dir->direntlen);
> - previous_dir->direntlen =
> cpu_to_le16(new_len);
> - } else {
> - dir->inode = 0;
> - }
> break;
> }
>
> @@ -905,7 +895,20 @@ static int unlink_filename(char *filename,
> unsigned int blknr) } while (offset < fs->blksz);
>
> if (inodeno > 0) {
> + printf("file found, deleting\n");
> + if (ext4fs_log_journal(block_buffer, blknr))
> + goto fail;
>
> + if (previous_dir) {
> + /* merge dir entry with predecessor */
> + uint16_t new_len;
> + new_len =
> le16_to_cpu(previous_dir->direntlen);
> + new_len += le16_to_cpu(dir->direntlen);
> + previous_dir->direntlen =
> cpu_to_le16(new_len);
> + } else {
> + /* invalidate dir entry */
> + dir->inode = 0;
> + }
> if (ext4fs_put_metadata(block_buffer, blknr))
> goto fail;
> ret = inodeno;
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
next prev parent reply other threads:[~2016-10-14 10:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20161009181528.26022-1-stefan.bruens@rwth-aachen.de>
2016-10-09 18:15 ` [U-Boot] [PATCH 1/3] ext4: cleanup unlink_filename function Stefan Brüns
2016-10-13 14:14 ` Tom Rini
2016-10-24 15:23 ` [U-Boot] [U-Boot,1/3] " Tom Rini
2016-10-09 18:15 ` [U-Boot] [PATCH 2/3] ext4: Fix handling of direntlen in unlink_filename Stefan Brüns
2016-10-13 14:14 ` Tom Rini
2016-10-14 10:29 ` Lukasz Majewski
2016-10-24 15:23 ` [U-Boot] [U-Boot, " Tom Rini
2016-10-09 18:15 ` [U-Boot] [PATCH 3/3] ext4: Only write journal entries for modified blocks " Stefan Brüns
2016-10-13 14:14 ` Tom Rini
2016-10-14 10:31 ` Lukasz Majewski [this message]
2016-10-24 15:24 ` [U-Boot] [U-Boot, " Tom Rini
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=20161014123144.6940ad87@amdc2363 \
--to=l.majewski@samsung.com \
--cc=u-boot@lists.denx.de \
/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