linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fusionio.com>
To: Aastha Mehta <aasthakm@gmail.com>
Cc: Josef Bacik <josef@toxicpanda.com>,
	Josef Bacik <JBacik@fusionio.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: basic questions regarding COW in Btrfs
Date: Mon, 25 Feb 2013 12:27:19 -0500	[thread overview]
Message-ID: <20130225172719.GA2434@localhost.localdomain> (raw)
In-Reply-To: <CAEx9m45V6aUkNQe0PTf+qJjpkJLHyMc4UBfSex9mxGOy-X7GrQ@mail.gmail.com>

On Mon, Feb 25, 2013 at 08:15:40AM -0700, Aastha Mehta wrote:
> Thanks again Josef.
> 
> I understood that cow_file_range is called for a regular file. Just to
> clarify, in cow_file_range is cow done at the time of reserving
> extents in the extent btree for the io to be done in this delalloc? I
> see the following comment above find_free_extent() which is called
> while trying to reserve extents:
> 
> /*
>  * walks the btree of allocated extents and find a hole of a given size.
>  * The key ins is changed to record the hole:
>  * ins->objectid == block start
>  * ins->flags = BTRFS_EXTENT_ITEM_KEY
>  * ins->offset == number of blocks
>  * Any available blocks before search_start are skipped.
>  */
> 
> This seems to be the only place where a cow might be done, because a
> key is being inserted into an extent which modifies it.
>

The key isn't inserted at this time, it's just returned with those values for us
to do as we please.  There is no update of the btree until
insert_reserved_extent/btrfs_mark_extent_written in btrfs_finish_ordered_io.
Thanks,

Josef 

  reply	other threads:[~2013-02-25 17:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20 17:28 basic questions regarding COW in Btrfs Aastha Mehta
2013-02-20 17:54 ` Josef Bacik
2013-02-21 17:32   ` Aastha Mehta
2013-02-23  9:33     ` Aastha Mehta
     [not found]     ` <CAEzrpqcGeiq=tHEvcH9625vZpCZaD94PrpjYO1_r4nS2GP9ByA@mail.gmail.com>
2013-02-25 15:15       ` Aastha Mehta
2013-02-25 17:27         ` Josef Bacik [this message]
2013-02-25 19:00           ` Aastha Mehta
2013-03-02 21:07             ` Alex Lyakas
2013-03-03 23:42               ` Josef Bacik
2013-03-03 15:41             ` Aastha Mehta
2013-03-03 23:52               ` Josef Bacik
2013-03-05  0:57                 ` Aastha Mehta
2013-03-05  1:51                   ` Josef Bacik
2013-03-05  1:55                     ` Aastha Mehta

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=20130225172719.GA2434@localhost.localdomain \
    --to=jbacik@fusionio.com \
    --cc=aasthakm@gmail.com \
    --cc=josef@toxicpanda.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;
as well as URLs for NNTP newsgroup(s).