Bug 1861108

Summary: RFE: make cp default to reflink=auto
Product: [Fedora] Fedora Reporter: Chris Murphy <bugzilla>
Component: coreutilsAssignee: Kamil Dudka <kdudka>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: admiller, fedoraproject, jamartis, jarodwilson, kdudka, kzak, ooprala, ovasik, p, sebastian.kisela, svashisht
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: coreutils-8.32-11.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-08-20 11:30:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1851166    

Description Chris Murphy 2020-07-27 20:27:11 UTC
It would be nice if cp defaults to reflink=auto, to go along with F33 feature:
https://fedoraproject.org/wiki/Changes/BtrfsByDefault

Current master uses reflink=auto
https://github.com/coreutils/coreutils/blob/master/src/cp.c#L796

Recent discussion
https://lists.gnu.org/archive/html/bug-coreutils/2020-06/msg00031.html

The patch
https://lists.gnu.org/archive/html/bug-coreutils/2020-06/msg00032.html

The commit: "cp: default to COW"
http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=25725f9d41735d176d73a757430739fb71c7d043


Additional info:

On 6/25, four more commits show up for copy.c - I'm not certain if they should be applied as well.
http://git.savannah.gnu.org/cgit/coreutils.git/log/

Comment 1 Kamil Dudka 2020-07-27 21:10:55 UTC
Thanks for the report!  I will pick the upstream commit that changes the default.  The other commits do not seem to be needed for this to work at first glance.

Comment 2 Pádraig Brady 2020-07-27 21:35:23 UTC
That single commit should suffice, and does seem appropriate given the change to BTRFS as the default

Comment 3 Chris Murphy 2020-07-27 22:23:21 UTC
Yep, definitely not required, but nice to have. I'm not sure when coreutils 8.33 is planned, but looks like this change will be included in that version when it happens.

Comment 4 Kamil Dudka 2020-07-30 16:19:45 UTC
dist-git commit: https://src.fedoraproject.org/rpms/coreutils/c/5d08d14b

Comment 5 Chris Murphy 2020-08-20 03:58:25 UTC
$ journalctl -b > journal.log
$ cp journal.log journal2.log 
$ filefrag -v *log
Filesystem type is: 9123683e
File size of journal2.log is 838227 (205 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..      31:    3792612..   3792643:     32:             encoded,shared
   1:       32..      63:    3792616..   3792647:     32:    3792644: encoded,shared
   2:       64..      95:    3793106..   3793137:     32:    3792648: encoded,shared
   3:       96..     127:    3793110..   3793141:     32:    3793138: encoded,shared
   4:      128..     159:    3577558..   3577589:     32:    3793142: encoded,shared
   5:      160..     191:    3793114..   3793145:     32:    3577590: encoded,shared
   6:      192..     204:    3793117..   3793129:     13:    3793146: last,encoded,shared,eof
journal2.log: 7 extents found
File size of journal.log is 838227 (205 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..      31:    3792612..   3792643:     32:             encoded,shared
   1:       32..      63:    3792616..   3792647:     32:    3792644: encoded,shared
   2:       64..      95:    3793106..   3793137:     32:    3792648: encoded,shared
   3:       96..     127:    3793110..   3793141:     32:    3793138: encoded,shared
   4:      128..     159:    3577558..   3577589:     32:    3793142: encoded,shared
   5:      160..     191:    3793114..   3793145:     32:    3577590: encoded,shared
   6:      192..     204:    3793117..   3793129:     13:    3793146: last,encoded,shared,eof
journal.log: 7 extents found
$ 


Looks good to me.

Comment 6 Kamil Dudka 2020-08-20 11:30:04 UTC
Perfect.  Thank you for verifying it!