All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>,
	linux@sciencehorizons.net
Subject: Re: [PATCH 3/4] ext4: avoid calling ext4_mark_inode_dirty() under unneeded semaphores
Date: Fri, 20 Jan 2017 14:37:37 +0100	[thread overview]
Message-ID: <20170120133737.GA10446@quack2.suse.cz> (raw)
In-Reply-To: <20170112034938.5934-5-tytso@mit.edu>

On Wed 11-01-17 22:49:37, Ted Tso wrote:
> There is no need to call ext4_mark_inode_dirty while holding xattr_sem
> or i_data_sem, so where it's easy to avoid it, move it out from the
> critical region.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Looks good to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/inline.c | 9 +++------
>  fs/ext4/inode.c  | 2 +-
>  2 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> index 99a5312ced52..31f98dd04e51 100644
> --- a/fs/ext4/inline.c
> +++ b/fs/ext4/inline.c
> @@ -1042,7 +1042,6 @@ static int ext4_add_dirent_to_inline(handle_t *handle,
>  	dir->i_mtime = dir->i_ctime = current_time(dir);
>  	ext4_update_dx_flag(dir);
>  	dir->i_version++;
> -	ext4_mark_inode_dirty(handle, dir);
>  	return 1;
>  }
>  
> @@ -1311,8 +1310,8 @@ int ext4_try_add_inline_entry(handle_t *handle, struct ext4_filename *fname,
>  	ret = ext4_convert_inline_data_nolock(handle, dir, &iloc);
>  
>  out:
> -	ext4_mark_inode_dirty(handle, dir);
>  	ext4_write_unlock_xattr(dir, &no_expand);
> +	ext4_mark_inode_dirty(handle, dir);
>  	brelse(iloc.bh);
>  	return ret;
>  }
> @@ -1708,13 +1707,11 @@ int ext4_delete_inline_entry(handle_t *handle,
>  	if (err)
>  		goto out;
>  
> -	err = ext4_mark_inode_dirty(handle, dir);
> -	if (unlikely(err))
> -		goto out;
> -
>  	ext4_show_inline_dir(dir, iloc.bh, inline_start, inline_size);
>  out:
>  	ext4_write_unlock_xattr(dir, &no_expand);
> +	if (likely(err == 0))
> +		err = ext4_mark_inode_dirty(handle, dir);
>  	brelse(iloc.bh);
>  	if (err != -ENOENT)
>  		ext4_std_error(dir->i_sb, err);
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 88d57af1b516..86dde0667ccc 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -2464,8 +2464,8 @@ static int mpage_map_and_submit_extent(handle_t *handle,
>  			disksize = i_size;
>  		if (disksize > EXT4_I(inode)->i_disksize)
>  			EXT4_I(inode)->i_disksize = disksize;
> -		err2 = ext4_mark_inode_dirty(handle, inode);
>  		up_write(&EXT4_I(inode)->i_data_sem);
> +		err2 = ext4_mark_inode_dirty(handle, inode);
>  		if (err2)
>  			ext4_error(inode->i_sb,
>  				   "Failed to mark inode %lu dirty",
> -- 
> 2.11.0.rc0.7.gbe5a750
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2017-01-20 13:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  3:49 [PATCH 0/4] ext4 inline cleanup patches Theodore Ts'o
2017-01-12  3:49 ` [PATCH 1/4] ext4: add debug_want_extra_isize mount option Theodore Ts'o
2017-01-12 19:19   ` Andreas Dilger
2017-01-13  2:58     ` Theodore Ts'o
2017-01-12  3:49 ` [PATCH -v2] overlay: stress test changes to top and bottom layers simultaneously Theodore Ts'o
2017-01-12  3:54   ` Theodore Ts'o
2017-01-12  3:49 ` [PATCH 2/4] ext4: fix deadlock between inline_data and ext4_expand_extra_isize_ea() Theodore Ts'o
2017-01-20 13:53   ` Jan Kara
2017-01-22 22:25     ` Theodore Ts'o
2017-01-24 12:27       ` Jan Kara
2017-01-25  1:32         ` Theodore Ts'o
2017-01-12  3:49 ` [PATCH 3/4] ext4: avoid calling ext4_mark_inode_dirty() under unneeded semaphores Theodore Ts'o
2017-01-20 13:37   ` Jan Kara [this message]
2017-01-12  3:49 ` [PATCH 4/4] ext4: propagate error values from ext4_inline_data_truncate() Theodore Ts'o
2017-01-20 13:39   ` Jan Kara
2017-01-12  9:12 ` [PATCH 0/4] ext4 inline cleanup patches George Spelvin
2017-01-12 14:46   ` Theodore Ts'o
2017-01-18  8:21     ` kernel BUG at fs/ext4/inline.c:1943! George Spelvin
2017-01-19 17:50       ` ext4_iget:4740: inode #%ld: block 48: comm find: invalid block George Spelvin
2017-01-19 22:58       ` kernel BUG at fs/ext4/inline.c:1943! Theodore Ts'o
2017-01-20 19:14         ` Damien Guibouret
2017-01-20 19:17           ` Andreas Dilger
2017-01-20 22:24             ` Damien Guibouret

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=20170120133737.GA10446@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux@sciencehorizons.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.