From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5B28C43381 for ; Sun, 24 Mar 2019 14:07:23 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5C08C222DA for ; Sun, 24 Mar 2019 14:07:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C08C222DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vt.edu Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.91) (envelope-from ) id 1h83lv-0001dN-Gk; Sun, 24 Mar 2019 10:06:47 -0400 Received: from omr2.cc.ipv6.vt.edu ([2607:b400:92:8400:0:33:fb76:806e] helo=omr2.cc.vt.edu) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1h83lu-0001dG-C5 for kernelnewbies@kernelnewbies.org; Sun, 24 Mar 2019 10:06:46 -0400 Received: from mr5.cc.vt.edu (mail.ipv6.vt.edu [IPv6:2607:b400:92:9:0:9d:8fcb:4116]) by omr2.cc.vt.edu (8.14.4/8.14.4) with ESMTP id x2OE6iUN027892 for ; Sun, 24 Mar 2019 10:06:45 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mr5.cc.vt.edu (8.14.7/8.14.7) with ESMTP id x2OE6dUt014242 for ; Sun, 24 Mar 2019 10:06:44 -0400 Received: by mail-qk1-f198.google.com with SMTP id 75so6401825qki.13 for ; Sun, 24 Mar 2019 07:06:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :mime-version:date:message-id; bh=btnhpDIBSELhPP6lZzg3nL36q+pGLjsAGyfgwR6L7dk=; b=CtyESfH6XoCCcL0Q6KGxJC5EFdFkc8n4dsRLDbsBJKfWtPtwohsMOfnhlpbyKWad99 qbxGIyW8HmUOnTYCyq4DijEUzYYXPAB/Kdx22TQ9ov+d/gYDeYesMWdLRr+coHDHhD0O 6ntqLb9xcexRxIPnCBY49KgdEFg+IHYpSgeu1sZ+KwBbjnPQZSubDsbh/xarRko8NQIG 7XQdA483nqvJMv2/gvXSjBFf9Bvz2PP1X6Hdjg/gInO+4TmKFdLxVaR76PEn+5C8rS71 5cbvVzEo6jiDR7/p8x24LeRSaXYnIBiQlPIUNOs8s4Lk1Og93I25b8AIFhRrZqMhylSK UE+A== X-Gm-Message-State: APjAAAX/WRzcOThCqqnRtZvl8hLfPChNT+WlXL8F+LuAdwvIfk6H5nI5 ZpL3rVEbAqA3GDPVoJ8D6FuN/1N5WhB+ppEZXaR5iOCbxPDUtx0PXlNDwuso3w7P7xJUNagzB6n 6VH3HA36nThiSiSQlQj17UnizlzjKSBhncagd5go= X-Received: by 2002:ac8:13c5:: with SMTP id i5mr4929049qtj.42.1553436399655; Sun, 24 Mar 2019 07:06:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFuyDxDPcx50DSjG7WT2NonwPT4E0MkE4vYisFun9jPqN0LrhP97fkiFTvzVB8tvtSlIPd5A== X-Received: by 2002:ac8:13c5:: with SMTP id i5mr4929031qtj.42.1553436399414; Sun, 24 Mar 2019 07:06:39 -0700 (PDT) Received: from turing-police ([2601:5c0:c001:4341::7ca]) by smtp.gmail.com with ESMTPSA id u57sm9706517qta.12.2019.03.24.07.06.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 24 Mar 2019 07:06:37 -0700 (PDT) From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Google-Original-From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: Bharath Vedartham Subject: Re: Overwriting copy functionality in filesystem In-reply-to: <20190324131808.GA24735@bharath12345-Inspiron-5559> References: <20190323165945.GA13199@bharath12345-Inspiron-5559> <13539.1553367716@turing-police> <20190324131808.GA24735@bharath12345-Inspiron-5559> Mime-Version: 1.0 Date: Sun, 24 Mar 2019 10:06:36 -0400 Message-ID: <10332.1553436396@turing-police> Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org 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. > 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? 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