Re: [PATCH] ovl: copy-up optimization for truncate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 ---- 在 星期四, 2021-04-01 19:31:12 Miklos Szeredi <miklos@xxxxxxxxxx> 撰写 ----
 > On Thu, Apr 1, 2021 at 1:15 PM Chengguang Xu <cgxu519@xxxxxxxxxxxx> wrote:
 > >
 > >  ---- 在 星期一, 2021-03-29 23:13:52 Miklos Szeredi <miklos@xxxxxxxxxx> 撰写 ----
 > >  > On Mon, Mar 8, 2021 at 12:17 PM Chengguang Xu <cgxu519@xxxxxxxxxxxx> 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




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux