* [PATCH v2] btrfs: cow_file_range() num_bytes and disk_num_bytes are same
@ 2018-02-15 4:29 Anand Jain
2018-02-15 8:38 ` Nikolay Borisov
0 siblings, 1 reply; 3+ messages in thread
From: Anand Jain @ 2018-02-15 4:29 UTC (permalink / raw)
To: linux-btrfs
This patch deletes local variable disk_num_bytes as its value
is same as num_bytes in the function cow_file_range().
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v1->v2:
Fix conflict.
Removed Reviewed-by: David Sterba <dsterba@suse.com>
as there is a conflict fix.
fs/btrfs/inode.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8997e39c8e37..4b156e191592 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -959,7 +959,6 @@ static noinline int cow_file_range(struct inode *inode,
u64 alloc_hint = 0;
u64 num_bytes;
unsigned long ram_size;
- u64 disk_num_bytes;
u64 cur_alloc_size = 0;
u64 blocksize = fs_info->sectorsize;
struct btrfs_key ins;
@@ -977,7 +976,6 @@ static noinline int cow_file_range(struct inode *inode,
num_bytes = ALIGN(end - start + 1, blocksize);
num_bytes = max(blocksize, num_bytes);
- disk_num_bytes = num_bytes;
inode_should_defrag(BTRFS_I(inode), start, end, num_bytes, SZ_64K);
@@ -1008,15 +1006,15 @@ static noinline int cow_file_range(struct inode *inode,
}
}
- BUG_ON(disk_num_bytes >
+ BUG_ON(num_bytes >
btrfs_super_total_bytes(fs_info->super_copy));
alloc_hint = get_extent_allocation_hint(inode, start, num_bytes);
btrfs_drop_extent_cache(BTRFS_I(inode), start,
start + num_bytes - 1, 0);
- while (disk_num_bytes > 0) {
- cur_alloc_size = disk_num_bytes;
+ while (num_bytes > 0) {
+ cur_alloc_size = num_bytes;
ret = btrfs_reserve_extent(root, cur_alloc_size, cur_alloc_size,
fs_info->sectorsize, 0, alloc_hint,
&ins, 1, 1);
@@ -1080,11 +1078,10 @@ static noinline int cow_file_range(struct inode *inode,
delalloc_end, locked_page,
EXTENT_LOCKED | EXTENT_DELALLOC,
page_ops);
- if (disk_num_bytes < cur_alloc_size)
- disk_num_bytes = 0;
+ if (num_bytes < cur_alloc_size)
+ num_bytes = 0;
else
- disk_num_bytes -= cur_alloc_size;
- num_bytes -= cur_alloc_size;
+ num_bytes -= cur_alloc_size;
alloc_hint = ins.objectid + ins.offset;
start += cur_alloc_size;
extent_reserved = false;
--
2.15.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] btrfs: cow_file_range() num_bytes and disk_num_bytes are same
2018-02-15 4:29 [PATCH v2] btrfs: cow_file_range() num_bytes and disk_num_bytes are same Anand Jain
@ 2018-02-15 8:38 ` Nikolay Borisov
2018-02-19 15:07 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Borisov @ 2018-02-15 8:38 UTC (permalink / raw)
To: Anand Jain, linux-btrfs
On 15.02.2018 06:29, Anand Jain wrote:
> This patch deletes local variable disk_num_bytes as its value
> is same as num_bytes in the function cow_file_range().
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> v1->v2:
> Fix conflict.
> Removed Reviewed-by: David Sterba <dsterba@suse.com>
> as there is a conflict fix.
>
> fs/btrfs/inode.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 8997e39c8e37..4b156e191592 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -959,7 +959,6 @@ static noinline int cow_file_range(struct inode *inode,
> u64 alloc_hint = 0;
> u64 num_bytes;
> unsigned long ram_size;
> - u64 disk_num_bytes;
> u64 cur_alloc_size = 0;
> u64 blocksize = fs_info->sectorsize;
> struct btrfs_key ins;
> @@ -977,7 +976,6 @@ static noinline int cow_file_range(struct inode *inode,
>
> num_bytes = ALIGN(end - start + 1, blocksize);
> num_bytes = max(blocksize, num_bytes);
> - disk_num_bytes = num_bytes;
>
> inode_should_defrag(BTRFS_I(inode), start, end, num_bytes, SZ_64K);
>
> @@ -1008,15 +1006,15 @@ static noinline int cow_file_range(struct inode *inode,
> }
> }
>
> - BUG_ON(disk_num_bytes >
> + BUG_ON(num_bytes >
> btrfs_super_total_bytes(fs_info->super_copy));
>
> alloc_hint = get_extent_allocation_hint(inode, start, num_bytes);
> btrfs_drop_extent_cache(BTRFS_I(inode), start,
> start + num_bytes - 1, 0);
>
> - while (disk_num_bytes > 0) {
> - cur_alloc_size = disk_num_bytes;
> + while (num_bytes > 0) {
> + cur_alloc_size = num_bytes;
> ret = btrfs_reserve_extent(root, cur_alloc_size, cur_alloc_size,
> fs_info->sectorsize, 0, alloc_hint,
> &ins, 1, 1);
> @@ -1080,11 +1078,10 @@ static noinline int cow_file_range(struct inode *inode,
> delalloc_end, locked_page,
> EXTENT_LOCKED | EXTENT_DELALLOC,
> page_ops);
> - if (disk_num_bytes < cur_alloc_size)
> - disk_num_bytes = 0;
> + if (num_bytes < cur_alloc_size)
> + num_bytes = 0;
> else
> - disk_num_bytes -= cur_alloc_size;
> - num_bytes -= cur_alloc_size;
> + num_bytes -= cur_alloc_size;
> alloc_hint = ins.objectid + ins.offset;
> start += cur_alloc_size;
> extent_reserved = false;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] btrfs: cow_file_range() num_bytes and disk_num_bytes are same
2018-02-15 8:38 ` Nikolay Borisov
@ 2018-02-19 15:07 ` David Sterba
0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2018-02-19 15:07 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: Anand Jain, linux-btrfs
On Thu, Feb 15, 2018 at 10:38:00AM +0200, Nikolay Borisov wrote:
>
>
> On 15.02.2018 06:29, Anand Jain wrote:
> > This patch deletes local variable disk_num_bytes as its value
> > is same as num_bytes in the function cow_file_range().
> >
> > Signed-off-by: Anand Jain <anand.jain@oracle.com>
>
> Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Added to next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-19 15:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-15 4:29 [PATCH v2] btrfs: cow_file_range() num_bytes and disk_num_bytes are same Anand Jain
2018-02-15 8:38 ` Nikolay Borisov
2018-02-19 15:07 ` David Sterba
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.