Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
From: Bharath Vedartham <linux.bhar@gmail.com>
To: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Overwriting copy functionality in filesystem
Date: Fri, 29 Mar 2019 00:00:17 +0530
Message-ID: <20190328183017.GA3568@bharath12345-Inspiron-5559> (raw)
In-Reply-To: <10332.1553436396@turing-police>

On Sun, Mar 24, 2019 at 10:06:36AM -0400, Valdis Klētnieks wrote:
> On Sun, 24 Mar 2019 18:48:08 +0530, Bharath Vedartham said:
> 
> > I was interested in implementing copy-on-write for my filesystem(for fun
> > :P). When I do a "cp" operation, I do not want to create a seperate
> > inode for the new file. I only want to create a inode when I make a
> > change to the file.
> 
> Actually, /bin/cp isn't where copy-on-write gets you benefits. Where it really
> shines is when you have a versioning filesystem that keeps track of the last
> N versions of a file with minimum overhead. So if you have a 100 megabyte
> file, open it, write 5 blocks of data, and close it, you now can read back
> either the original or new versions of the file, and you're only using 100M plus
> 5 blocks plus a tiny bit of metadata.
> 
That is a very interesting use case.  Any examples of filesystems like
that in the kernel? 
I was thinking of a use case where we are copying a huge file (say 100
GB), if we do copy-on-write we can speed up /bin/cp for such files i
feel. Any comments on this?
> > There is no vfs api for cp. I would need to make creat syscall aware of the
> > fact that it is being executed by "cp". My immediate idea was to check
> > if a file with the same data exists in the filesystem but that would be
> > way too much overhead.
> 
> Have you looked at other filesystems that already support copy-on-write?
>
I have been looking at overlayfs. But overlayfs uses a lower read-only
layer and an upper layer where changes are reflected. I am more
interested in filesystems without any layering which support
copy-on-write. Are there other filesystems in the kernel which support
copy-on-write?
> Hint:  How do file systems that support point-in-time snapshots work?


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-23 16:59 Bharath Vedartham
2019-03-23 19:01 ` Valdis Klētnieks
2019-03-24 13:18   ` Bharath Vedartham
2019-03-24 14:06     ` Valdis Klētnieks
2019-03-28 18:30       ` Bharath Vedartham [this message]
2019-03-28 20:07         ` Valdis Klētnieks
2019-03-23 19:03 ` Bernd Petrovitsch
2019-03-24 13:21   ` Bharath Vedartham
2019-03-23 19:05 ` Greg KH

Reply instructions:

You may reply publically 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=20190328183017.GA3568@bharath12345-Inspiron-5559 \
    --to=linux.bhar@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=valdis.kletnieks@vt.edu \
    /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

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org kernelnewbies@archiver.kernel.org
	public-inbox-index kernelnewbies


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/ public-inbox