Linux-BTRFS Archive on lore.kernel.org
 help / color / Atom feed
From: Filipe Manana <fdmanana@gmail.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>, kernel-team@fb.com
Subject: Re: [PATCH 4/5] btrfs: replace all uses of btrfs_ordered_update_i_size
Date: Wed, 15 Jan 2020 17:13:27 +0000
Message-ID: <CAL3q7H7g=zaW-aTp9pekFUepYZSv-zCCzfSEsw0O5=ctQhwkHw@mail.gmail.com> (raw)
In-Reply-To: <20200107194237.145694-5-josef@toxicpanda.com>

On Tue, Jan 7, 2020 at 7:43 PM Josef Bacik <josef@toxicpanda.com> wrote:
>
> Now that we have a safe way to update the i_size, replace all uses of
> btrfs_ordered_update_i_size with btrfs_inode_safe_disk_i_size_write.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Filipe Manana <fdmanana@suse.com>

Looks good, thanks.

> ---
>  fs/btrfs/file.c  |  2 +-
>  fs/btrfs/inode.c | 12 ++++++------
>  fs/btrfs/ioctl.c |  2 +-
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index f1c880c06ca2..35fdc5b99804 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -2941,7 +2941,7 @@ static int btrfs_fallocate_update_isize(struct inode *inode,
>
>         inode->i_ctime = current_time(inode);
>         i_size_write(inode, end);
> -       btrfs_ordered_update_i_size(inode, end, NULL);
> +       btrfs_inode_safe_disk_i_size_write(inode, 0);
>         ret = btrfs_update_inode(trans, root, inode);
>         ret2 = btrfs_end_transaction(trans);
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 5d34007aa7ec..4a3ef3174d73 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -3119,7 +3119,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
>                  */
>                 btrfs_qgroup_free_data(inode, NULL, ordered_extent->file_offset,
>                                        ordered_extent->len);
> -               btrfs_ordered_update_i_size(inode, 0, ordered_extent);
> +               btrfs_inode_safe_disk_i_size_write(inode, 0);
>                 if (freespace_inode)
>                         trans = btrfs_join_transaction_spacecache(root);
>                 else
> @@ -3207,7 +3207,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
>                 goto out;
>         }
>
> -       btrfs_ordered_update_i_size(inode, 0, ordered_extent);
> +       btrfs_inode_safe_disk_i_size_write(inode, 0);
>         ret = btrfs_update_inode_fallback(trans, root, inode);
>         if (ret) { /* -ENOMEM or corruption */
>                 btrfs_abort_transaction(trans, ret);
> @@ -5007,7 +5007,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
>                 ASSERT(last_size >= new_size);
>                 if (!ret && last_size > new_size)
>                         last_size = new_size;
> -               btrfs_ordered_update_i_size(inode, last_size, NULL);
> +               btrfs_inode_safe_disk_i_size_write(inode, last_size);
>         }
>
>         btrfs_free_path(path);
> @@ -5337,7 +5337,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
>                 }
>
>                 i_size_write(inode, newsize);
> -               btrfs_ordered_update_i_size(inode, i_size_read(inode), NULL);
> +               btrfs_inode_safe_disk_i_size_write(inode, 0);
>                 pagecache_isize_extended(inode, oldsize, newsize);
>                 ret = btrfs_update_inode(trans, root, inode);
>                 btrfs_end_write_no_snapshotting(root);
> @@ -9319,7 +9319,7 @@ static int btrfs_truncate(struct inode *inode, bool skip_writeback)
>                         ret = PTR_ERR(trans);
>                         goto out;
>                 }
> -               btrfs_ordered_update_i_size(inode, inode->i_size, NULL);
> +               btrfs_inode_safe_disk_i_size_write(inode, 0);
>         }
>
>         if (trans) {
> @@ -10578,7 +10578,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
>                         else
>                                 i_size = cur_offset;
>                         i_size_write(inode, i_size);
> -                       btrfs_ordered_update_i_size(inode, i_size, NULL);
> +                       btrfs_inode_safe_disk_i_size_write(inode, 0);
>                 }
>
>                 ret = btrfs_update_inode(trans, root, inode);
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 291dda3b6547..2a02a21cac59 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -3334,7 +3334,7 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans,
>                 endoff = destoff + olen;
>         if (endoff > inode->i_size) {
>                 i_size_write(inode, endoff);
> -               btrfs_ordered_update_i_size(inode, endoff, NULL);
> +               btrfs_inode_safe_disk_i_size_write(inode, 0);
>         }
>
>         ret = btrfs_update_inode(trans, root, inode);
> --
> 2.23.0
>


-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”

  reply index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 19:42 [PATCH 0/5][v2] btrfs: fix hole corruption issue with !NO_HOLES Josef Bacik
2020-01-07 19:42 ` [PATCH 1/5] btrfs: use btrfs_ordered_update_i_size in clone_finish_inode_update Josef Bacik
2020-01-15 17:01   ` Filipe Manana
2020-01-07 19:42 ` [PATCH 2/5] btrfs: introduce the inode->file_extent_tree Josef Bacik
2020-01-15 17:10   ` Filipe Manana
2020-01-07 19:42 ` [PATCH 3/5] btrfs: use the file extent tree infrastructure Josef Bacik
2020-01-15 17:12   ` Filipe Manana
2020-01-15 17:20     ` Josef Bacik
2020-01-15 17:34       ` Filipe Manana
2020-01-16 12:46   ` Filipe Manana
2020-01-07 19:42 ` [PATCH 4/5] btrfs: replace all uses of btrfs_ordered_update_i_size Josef Bacik
2020-01-15 17:13   ` Filipe Manana [this message]
2020-01-07 19:42 ` [PATCH 5/5] btrfs: delete the ordered isize update code Josef Bacik
2020-01-15 17:13   ` Filipe Manana
2020-01-15 17:32 ` [PATCH 0/5][v2] btrfs: fix hole corruption issue with !NO_HOLES Filipe Manana
2020-01-15 18:44   ` Josef Bacik
  -- strict thread matches above, loose matches on Subject: below --
2019-12-30 21:31 [RFC][PATCH 0/5] " Josef Bacik
2019-12-30 21:31 ` [PATCH 4/5] btrfs: replace all uses of btrfs_ordered_update_i_size Josef Bacik

Reply instructions:

You may reply publically 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='CAL3q7H7g=zaW-aTp9pekFUepYZSv-zCCzfSEsw0O5=ctQhwkHw@mail.gmail.com' \
    --to=fdmanana@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@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

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org
	public-inbox-index linux-btrfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git