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 14:51:10 +0800 [thread overview]
Message-ID: <4F54625E.6040003@oracle.com> (raw)
In-Reply-To: <CAE5mzvjiL+81AsSspTrE1A1BBiL27zJ1qK1oqCF27oL+-CG9Mw@mail.gmail.com>
>(notably the direct modification of
> crontab files, which is considered to be an internal detail if I
> understand correctly, and I'm fairly certain is broken as written),
I did came across that point of view however, using crontab cli in the
program wasn't convincing either, (library call would have been better).
any other better ways to manage cron entries ?
> and how it writes to its own config file.
Hm. not sure if I understand this. you mean having binary file not
a good idea ?
> Neither has any business in btrfs-progs in my somewhat irrelevant opinion. :p
A separate autosnap script (outside btrfs-progs) was in the original
plan. But having an integrated solution plus without having to manage
a new script will certainly help sysadmins IMO. (But if there is no
strong interest I would separate it out).
> It also does not appear to handle mountpoints in its directory walk,
> which will cause grief if snapshotting /
Not sure if I understand this correctly. I manage with fsid.
But, as of now autosnap isn't designed to handle root OR the mount point.
(this is covered in the caveat section in the btrfs autosnap wiki).
We still need more work from the btrfs kernel if we are taking the
snapshot of the mountpoint (as in the wiki FAQ as well).
> There doesn't appear to be any reason for the scratch file to exist at
> all (one can build up the hash while reading the directories), and
> keeping a scratch file in /etc/ is poor practice in the first place
> (that's what /tmp and/or /var/run is for).
Right. sorry, my mistake I didn't change back to tmp location after debugging.
> It's also a lot of io to
> stat every file in the subvolume every time you make a snapshot, and
> I'm not convinced that the walk is actually correctly implemented:
> what stops an autosnap of / from including all of /proc and /sys in
> the hash?
Autosnap are for the subvols excluding the mount-point itself.
Yes we need to look this part when we support the root / mount-point.
(This is mentioned the caveat section in autosnap wiki, however will
put more emphasis, thanks for highlighting the real problem).
> Perhaps all that is unnecessary: rather than doing the walk, why not
> make use of btrfs subvolume find-new (or rather, the syscalls it
> uses)?
>
> 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).
>
> This avoids creating and immediately deleting a snapshot every time
> nothing has changed, completely avoids the need to stat the entire
> subvolume every time, and removes the dependency on the crypto libs.
right. Hashing isn't (performance) scalable, and not a good idea to
fill SSDs with non-application-data at each autosnap. Relaying on
transaction id will help when transactions are committed. Will get
this coded this way.
thanks, Anand
next prev parent reply other threads:[~2012-03-05 6:51 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 [this message]
2012-03-05 7:07 ` Fajar A. Nugraha
2012-03-05 7:18 ` Arne Jansen
2012-03-05 10:21 ` Anand Jain
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=4F54625E.6040003@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).