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

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

 



 ---- 在 星期一, 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.
 > 
 > But need to be careful, because we could possibly have other attribute
 > change requests besides ATTR_SIZE, in which case optimizing the
 > truncate away and returning success wouldn't be correct.

OK, I'll modify in V2.

 > 
 > Minor issue: this patch doesn't optimize the truncate to zero case.
 > That's not a bug, but I'm curious if that is an oversight or
 > deliberate.
 > 

I overlooked that case because all our cases use O_TRUNC flag on open time
when truncate to zero size. How about specify O_TRUNC flag when calling
copy-up function for this case?


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