linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chengguang Xu <cgxu519@mykernel.net>
To: "Miklos Szeredi" <miklos@szeredi.hu>
Cc: "overlayfs" <linux-unionfs@vger.kernel.org>
Subject: Re: [PATCH] ovl: copy-up optimization for truncate
Date: Thu, 01 Apr 2021 20:39:05 +0800	[thread overview]
Message-ID: <1788d71bfa9.1085d20533394.4611084846534174960@mykernel.net> (raw)
In-Reply-To: <CAJfpegt_r6rWFMjpLxmQK8saQ=G01RKSd=5+GUCnz_By_27EGg@mail.gmail.com>

 ---- 在 星期四, 2021-04-01 19:31:12 Miklos Szeredi <miklos@szeredi.hu> 撰写 ----
 > On Thu, Apr 1, 2021 at 1:15 PM Chengguang Xu <cgxu519@mykernel.net> wrote:
 > >
 > >  ---- 在 星期一, 2021-03-29 23:13:52 Miklos Szeredi <miklos@szeredi.hu> 撰写 ----
 > >  > On Mon, Mar 8, 2021 at 12:17 PM Chengguang Xu <cgxu519@mykernel.net> wrote:
 > >  > >
 > >  > > Currently copy-up will copy whole lower file to upper
 > >  > > regardless of the data range which is needed for further
 > >  > > operation. This patch avoids unnecessary copy when truncate
 > >  > > size is smaller than the file size.
 > >  >
 > >  > This doesn't look right.   If copy up succeeds, resulting in a
 > >  > truncated file, then we should return success there and then.   Doing
 > >  > the truncate again and failing (unlikely, but I wouldn't think it
 > >  > impossible) wouldn't be nice.
 > >
 > > Hi Miklos
 > >
 > > I noticed a problem here, if we just return success after copy-up then mtime
 > > keeps the same as lower file. I think doing the truncate again would be better
 > > than manually updating the upper file's mtime. What do you think for this?
 > 
 > Let's simplify instead:  skip the mtime restore on copy-up.   Not sure
 > how that's handled on O_TRUNC opens, maybe it's relevant to that case
 > too.
 > 

Currently on O_TRUNC open, copy-up(zero size) triggered by vfs_open() then do the truncate(zero size)
operation by handle_truncate() afterwards. mtime will be updated after calling handle_truncate().



Thanks,
Chengguang

      reply	other threads:[~2021-04-01 20:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 11:17 [PATCH] ovl: copy-up optimization for truncate Chengguang Xu
2021-03-08 12:09 ` Amir Goldstein
2021-03-29 15:13 ` Miklos Szeredi
2021-03-30  7:17   ` Chengguang Xu
2021-04-01 11:15   ` Chengguang Xu
2021-04-01 11:31     ` Miklos Szeredi
2021-04-01 12:39       ` Chengguang Xu [this message]

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=1788d71bfa9.1085d20533394.4611084846534174960@mykernel.net \
    --to=cgxu519@mykernel.net \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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).