From: Anand Jain <Anand.Jain@oracle.com>
To: cwillu <cwillu@cwillu.com>
Cc: linux-btrfs@vger.kernel.org, hugo@carfax.org.uk, chris.mason@oracle.com
Subject: Re: [PATCH] [RFC] Add btrfs autosnap feature
Date: Mon, 05 Mar 2012 18:21:02 +0800 [thread overview]
Message-ID: <4F54938E.6080704@oracle.com> (raw)
In-Reply-To: <4F54625E.6040003@oracle.com>
>> Prior to making a new snapshot, grab the (stored) transid of the
>> previous snapshot, and check if any files have been modified in the
>> source since that transid: btrfs sub find "${source}"
>> "${previous_transid}". If nothing is returned, then you don't have to
>> bother making the snapshot at all, otherwise after making the
>> snapshot, grab the transid via btrfs sub find "${new_snapshot}" -1,
>> and store it some place (even a dot file in the root of the snapshot
>> would work).
there might be small window of time where transid and snapshot could
be out of sync as we know them. since there is no atomic command which
provides both - snapshot and transid. As in the example below.
Assume tgw is the transaction group write which happens after we have
read the transaction group id.
---
sync; read current tran-id and compare
(new tgw occurs)
snapshot
new tgw occurs
sync; read current tran-id again and store
---
which will result in failing to take snapshot even if there are changes.
Certainly there will be some trade off, and below logic seems to be
more safer...
---
sync; read current tran-id and compare with previous
new tgw occurs
snapshot
new tgw occurs
store tran_id+2 (since tran_id gets added by two for a snapshot)
---
which might have a situation where we have two identical snapshot.
but a safer trade off.
thanks, Anand
next prev parent reply other threads:[~2012-03-05 10:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-29 2:59 [RFC] [PATCH] Add btrfs autosnap feature asj
2012-02-29 2:59 ` [PATCH] [RFC] " asj
2012-02-29 3:38 ` Anand Jain
2012-03-01 11:54 ` cwillu
2012-03-02 11:34 ` Arvin Schnell
2012-03-02 12:04 ` cwillu
2012-03-02 12:25 ` Sander
2012-03-05 6:51 ` Anand Jain
2012-03-05 7:07 ` Fajar A. Nugraha
2012-03-05 7:18 ` Arne Jansen
2012-03-05 10:21 ` Anand Jain [this message]
2012-03-05 10:28 ` cwillu
2012-03-01 13:23 ` Roman Mamedov
2012-03-06 7:56 ` [PATCH 1/2] Make find_updated_files to return value instead of printing Anand jain
2012-03-06 7:56 ` [PATCH 2/2] Use transaction id to determin if there is any change in the subvol Anand jain
2012-03-06 9:07 ` [PATCH 2/2 v2] " Anand jain
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=4F54938E.6080704@oracle.com \
--to=anand.jain@oracle.com \
--cc=chris.mason@oracle.com \
--cc=cwillu@cwillu.com \
--cc=hugo@carfax.org.uk \
--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).