* [PATH]Fix cow semantic in run_delalloc_nocow()
@ 2008-11-20 9:02 Liu Hui
2008-11-20 13:30 ` Yan Zheng
0 siblings, 1 reply; 6+ messages in thread
From: Liu Hui @ 2008-11-20 9:02 UTC (permalink / raw)
To: linux-btrfs
Hi,
I found cow doesn't behave as expected in run_delalloc_nocow(). Now in
run_delalloc_now(), if it found a regular extent and the NODATACOW is
set, run_dealloc_now will cow the file range which is not as expected.
Also, if it find a regular extent and NODATACOW is not set(with
PREALLOC set), it will not take cow operation. So, the cow semantic is
opposite to the btrfs design.
I found the problem was introduced by fallocate(), so could Yan please
verify the fix? Much appreciated!
--
Thanks & Best Regards
Liu Hui
--
diff --git a/inode.c b/inode.c
index 2c77e09..5525594 100644
--- a/inode.c
+++ b/inode.c
@@ -1003,7 +1003,7 @@ next_slot:
goto out_check;
if (disk_bytenr == 0)
goto out_check;
- if (extent_type == BTRFS_FILE_EXTENT_REG && !force)
+ if (extent_type == BTRFS_FILE_EXTENT_REG && force)
goto out_check;
if (btrfs_cross_ref_exist(trans, root, disk_bytenr))
goto out_check;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATH]Fix cow semantic in run_delalloc_nocow()
2008-11-20 9:02 [PATH]Fix cow semantic in run_delalloc_nocow() Liu Hui
@ 2008-11-20 13:30 ` Yan Zheng
2008-11-20 13:47 ` Liu Hui
0 siblings, 1 reply; 6+ messages in thread
From: Yan Zheng @ 2008-11-20 13:30 UTC (permalink / raw)
To: Liu Hui; +Cc: linux-btrfs
2008/11/20 Liu Hui <onlyflyer@gmail.com>:
> Hi,
> I found cow doesn't behave as expected in run_delalloc_nocow(). Now in
> run_delalloc_now(), if it found a regular extent and the NODATACOW is
> set, run_dealloc_now will cow the file range which is not as expected.
> Also, if it find a regular extent and NODATACOW is not set(with
> PREALLOC set), it will not take cow operation. So, the cow semantic is
> opposite to the btrfs design.
>
> I found the problem was introduced by fallocate(), so could Yan please
> verify the fix? Much appreciated!
>
> --
> Thanks & Best Regards
> Liu Hui
> --
>
> diff --git a/inode.c b/inode.c
> index 2c77e09..5525594 100644
> --- a/inode.c
> +++ b/inode.c
> @@ -1003,7 +1003,7 @@ next_slot:
> goto out_check;
> if (disk_bytenr == 0)
> goto out_check;
> - if (extent_type == BTRFS_FILE_EXTENT_REG && !force)
> + if (extent_type == BTRFS_FILE_EXTENT_REG && force)
> goto out_check;
> if (btrfs_cross_ref_exist(trans, root, disk_bytenr))
> goto out_check;
> --
You are right, thanks. I suggest modifying run_delalloc_range instead of here,
could you please send a new patch.
Yan Zheng
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATH]Fix cow semantic in run_delalloc_nocow()
2008-11-20 13:30 ` Yan Zheng
@ 2008-11-20 13:47 ` Liu Hui
2008-11-20 16:19 ` Chris Mason
0 siblings, 1 reply; 6+ messages in thread
From: Liu Hui @ 2008-11-20 13:47 UTC (permalink / raw)
To: Yan Zheng; +Cc: linux-btrfs
Ok, this is the new patch.
--
Thanks & Best Regards
Liu Hui
--
diff --git a/inode.c b/inode.c
index 2c77e09..5e3789f 100644
--- a/inode.c
+++ b/inode.c
@@ -1114,10 +1114,10 @@ static int run_delalloc_range(struct inode
*inode, struct page *locked_page,
if (btrfs_test_opt(root, NODATACOW) ||
btrfs_test_flag(inode, NODATACOW))
ret = run_delalloc_nocow(inode, locked_page, start, end,
- page_started, 0, nr_written);
+ page_started, 1, nr_written);
else if (btrfs_test_flag(inode, PREALLOC))
ret = run_delalloc_nocow(inode, locked_page, start, end,
- page_started, 1, nr_written);
+ page_started, 0, nr_written);
else
ret = cow_file_range_async(inode, locked_page, start, end,
page_started, nr_written);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATH]Fix cow semantic in run_delalloc_nocow()
2008-11-20 13:47 ` Liu Hui
@ 2008-11-20 16:19 ` Chris Mason
2008-11-21 4:47 ` [PATCH]Fix " Liu Hui
0 siblings, 1 reply; 6+ messages in thread
From: Chris Mason @ 2008-11-20 16:19 UTC (permalink / raw)
To: Liu Hui; +Cc: Yan Zheng, linux-btrfs
On Thu, 2008-11-20 at 21:47 +0800, Liu Hui wrote:
> Ok, this is the new patch.
>
Thank you both, I've pushed this out.
-chris
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]Fix cow semantic in run_delalloc_nocow()
2008-11-20 16:19 ` Chris Mason
@ 2008-11-21 4:47 ` Liu Hui
2008-11-21 12:14 ` Chris Mason
0 siblings, 1 reply; 6+ messages in thread
From: Liu Hui @ 2008-11-21 4:47 UTC (permalink / raw)
To: Chris Mason; +Cc: Yan Zheng, linux-btrfs
Hi chris,
This is just a reminder to tell you that I found the commit message in
git log, but the code has not been checked in yet.
2008/11/21 Chris Mason <chris.mason@oracle.com>:
> On Thu, 2008-11-20 at 21:47 +0800, Liu Hui wrote:
>> Ok, this is the new patch.
>>
>
> Thank you both, I've pushed this out.
>
> -chris
>
>
>
--
Thanks & Best Regards
Liu Hui
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]Fix cow semantic in run_delalloc_nocow()
2008-11-21 4:47 ` [PATCH]Fix " Liu Hui
@ 2008-11-21 12:14 ` Chris Mason
0 siblings, 0 replies; 6+ messages in thread
From: Chris Mason @ 2008-11-21 12:14 UTC (permalink / raw)
To: Liu Hui; +Cc: Yan Zheng, linux-btrfs
On Fri, 2008-11-21 at 12:47 +0800, Liu Hui wrote:
> Hi chris,
> This is just a reminder to tell you that I found the commit message in
> git log, but the code has not been checked in yet.
>
You're right, somehow the commit ended up empty. I'll have to fix this
after vacation. Thanks.
-chris
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-11-21 12:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-20 9:02 [PATH]Fix cow semantic in run_delalloc_nocow() Liu Hui
2008-11-20 13:30 ` Yan Zheng
2008-11-20 13:47 ` Liu Hui
2008-11-20 16:19 ` Chris Mason
2008-11-21 4:47 ` [PATCH]Fix " Liu Hui
2008-11-21 12:14 ` Chris Mason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox