kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / 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: Sun, 24 Mar 2019 18:48:08 +0530	[thread overview]
Message-ID: <20190324131808.GA24735@bharath12345-Inspiron-5559> (raw)
In-Reply-To: <13539.1553367716@turing-police>

On Sat, Mar 23, 2019 at 03:01:56PM -0400, Valdis Klētnieks wrote:
> On Sat, 23 Mar 2019 22:29:45 +0530, Bharath Vedartham said:
> 
> > I was wondering how we can overwrite the copy functionality while
> > writing our own filesystem in linux. 
> > VFS does not offer any sort of API for copy. I think it calls create and
> > write when we execute the copy the file/dir.
> 
> Which you can verify using strace.  Which you should already be familiar with
> if you have the experience needed to write a usable filesystem.
>
Yes I did that. I have observed that it is a mixture of
create,read,write system calls.
> > I am interested in overwriting the way copy happens in my
> > filesystem(which I am writing for fun :p). 
> 
> And what, exactly, do you want copy to do differently on the API level,
> and on the file system level?
> 
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. 

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.


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

  reply	other threads:[~2019-03-24 13:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-23 16:59 Overwriting copy functionality in filesystem Bharath Vedartham
2019-03-23 19:01 ` Valdis Klētnieks
2019-03-24 13:18   ` Bharath Vedartham [this message]
2019-03-24 14:06     ` Valdis Klētnieks
2019-03-28 18:30       ` Bharath Vedartham
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 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=20190324131808.GA24735@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
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).