Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: "Liu Hui" <onlyflyer@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATH]Fix cow semantic in run_delalloc_nocow()
Date: Thu, 20 Nov 2008 17:02:56 +0800	[thread overview]
Message-ID: <2c3b11250811200102v4491b00cq1eacb633e9b46848@mail.gmail.com> (raw)

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;

             reply	other threads:[~2008-11-20  9:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-20  9:02 Liu Hui [this message]
2008-11-20 13:30 ` [PATH]Fix cow semantic in run_delalloc_nocow() 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

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=2c3b11250811200102v4491b00cq1eacb633e9b46848@mail.gmail.com \
    --to=onlyflyer@gmail.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
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