Re: [systemd-devel] [PATCH/resend] Use reflinking to copy kernel

2015-05-20 Thread Lennart Poettering
On Tue, 19.05.15 02:33, Pádraig Brady (p...@draigbrady.com) wrote:

 FYI...
 
 mv reflinks by default, but only in the unreleased V8.24 (Fedora 23).
 
 cp doesn't default to --reflink=auto as that would break the case where one 
 uses copy
 for durability reasons to have a second copy of the data.  Also for 
 performance reasons
 you may want the writes to happen at copy time rather than some latency 
 sensitive process
 working on a CoW file and being delayed by the writes possibly to a different 
 part of a mechanical disk.

I am pretty sure that both those usecases are of the more exotic kind,
and that reflinks should hence be the default, and people who want the
byte-by-byte kind of copy should request it explicitly with
--reflink=no or dd.

I think a good user interface make the common operations easy (and
hence default) and the exotic ones possible. For me that clearly means
that --reflink=auto should be the default, and --reflink=no the
option, and *not* the other way round...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH/resend] Use reflinking to copy kernel

2015-05-18 Thread Simon McVittie
On 18/05/15 13:15, Lennart Poettering wrote:
 --reflink=auto is the default in cp since a while.

I think you're thinking of recent mv versions, or a patched coreutils?

cp in current coreutils git never reflinks

http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/cp.c#n785

unless explictly requested

http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/cp.c#n957

(line numbers valid as of today's git master)

I believe the rationale is that people invoking cp(1) might expect to
have two entirely independent copies of all the file's disk blocks
afterwards, such that a kernel- or hardware-level bit-flip in one would
leave the other untouched - as opposed to reflinking, in which
*user-space* changes to one leave the other untouched. I don't
personally think that rationale is sufficiently convincing to outweigh
the simplicity of reflinking by default, but I don't maintain coreutils,
and perhaps I'd think differently if I did.

-- 
Simon McVittie
Collabora Ltd. http://www.collabora.com/

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH/resend] Use reflinking to copy kernel

2015-05-18 Thread Lennart Poettering
On Sat, 16.05.15 22:16, Zbigniew Jędrzejewski-Szmek (zbys...@in.waw.pl) wrote:

 On Fri, May 08, 2015 at 05:11:15PM -0400, Josh Boyer wrote:
  On May 8, 2015 11:38 AM, Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl
  wrote:
  
   On Thu, May 07, 2015 at 10:08:56PM -0400, Matthew Miller wrote:
On Thu, May 07, 2015 at 04:29:11PM -0500, Ian Pilcher wrote:
 Hmm.  If don't know off the top of my head if Fedora cloud images
  have a
 separate /boot or not, but disk space is a big concern in such
 environments.
   
They don't have a separate boot, fwiw.
   What about amending the patch to use
  
  cp --reflink=auto ...
  
   ?
  
  The kernel-install tool is what would need to be patched. It is what is
  doing the copying at install time.  Doing it in the spec is pointless as
  we're mucking around in the build root not the actual system.
 Strictly speaking, using --reflink=auto would be useful in the spec
 too, to avoid copying the files. In a build root it is very likely to
 succeed too.
 
 But you're right of course, it's kernel-install that counts.
 
 Patches for kernel-install and dracut attached.
 
 [Since this patch is for systemd, resending it to systemd-devel. I should
 have done in the first place. If intend to push it in a few days if nobody
 objects.]

--reflink=auto is the default in cp since a while. Instead of
cluttering systemd's or dracut's trees with it, I'd rather recommend
upgrading coreutils as necessary.

I don't think this should go in,

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH/resend] Use reflinking to copy kernel

2015-05-18 Thread Zbigniew Jędrzejewski-Szmek
On Mon, May 18, 2015 at 02:15:09PM +0200, Lennart Poettering wrote:
 On Sat, 16.05.15 22:16, Zbigniew Jędrzejewski-Szmek (zbys...@in.waw.pl) wrote:
 
  On Fri, May 08, 2015 at 05:11:15PM -0400, Josh Boyer wrote:
   On May 8, 2015 11:38 AM, Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl
   wrote:
   
On Thu, May 07, 2015 at 10:08:56PM -0400, Matthew Miller wrote:
 On Thu, May 07, 2015 at 04:29:11PM -0500, Ian Pilcher wrote:
  Hmm.  If don't know off the top of my head if Fedora cloud images
   have a
  separate /boot or not, but disk space is a big concern in such
  environments.

 They don't have a separate boot, fwiw.
What about amending the patch to use
   
   cp --reflink=auto ...
   
?
   
   The kernel-install tool is what would need to be patched. It is what is
   doing the copying at install time.  Doing it in the spec is pointless as
   we're mucking around in the build root not the actual system.
  Strictly speaking, using --reflink=auto would be useful in the spec
  too, to avoid copying the files. In a build root it is very likely to
  succeed too.
  
  But you're right of course, it's kernel-install that counts.
  
  Patches for kernel-install and dracut attached.
  
  [Since this patch is for systemd, resending it to systemd-devel. I should
  have done in the first place. If intend to push it in a few days if nobody
  objects.]
 
 --reflink=auto is the default in cp since a while. Instead of
 cluttering systemd's or dracut's trees with it, I'd rather recommend
 upgrading coreutils as necessary.
I don't think that's true. With today's git, without --reflink=auto,
cp does a normal read() + write(). I think the default for mv is to use
reflink though.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH/resend] Use reflinking to copy kernel

2015-05-18 Thread Lennart Poettering
On Mon, 18.05.15 13:56, Simon McVittie (simon.mcvit...@collabora.co.uk) wrote:

 On 18/05/15 13:15, Lennart Poettering wrote:
  --reflink=auto is the default in cp since a while.
 
 I think you're thinking of recent mv versions, or a patched
 coreutils?

Oh indeed, I noticed this behaviour on mv...

 I believe the rationale is that people invoking cp(1) might expect to
 have two entirely independent copies of all the file's disk blocks
 afterwards, such that a kernel- or hardware-level bit-flip in one would
 leave the other untouched - as opposed to reflinking, in which
 *user-space* changes to one leave the other untouched. I don't
 personally think that rationale is sufficiently convincing to outweigh
 the simplicity of reflinking by default, but I don't maintain coreutils,
 and perhaps I'd think differently if I did.

Yeah, I very much disagree with that upstream decision too... I mean,
if people really want byte copies they should think in terms of dd
not cp...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH/resend] Use reflinking to copy kernel

2015-05-16 Thread Zbigniew Jędrzejewski-Szmek
On Fri, May 08, 2015 at 05:11:15PM -0400, Josh Boyer wrote:
 On May 8, 2015 11:38 AM, Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl
 wrote:
 
  On Thu, May 07, 2015 at 10:08:56PM -0400, Matthew Miller wrote:
   On Thu, May 07, 2015 at 04:29:11PM -0500, Ian Pilcher wrote:
Hmm.  If don't know off the top of my head if Fedora cloud images
 have a
separate /boot or not, but disk space is a big concern in such
environments.
  
   They don't have a separate boot, fwiw.
  What about amending the patch to use
 
 cp --reflink=auto ...
 
  ?
 
 The kernel-install tool is what would need to be patched. It is what is
 doing the copying at install time.  Doing it in the spec is pointless as
 we're mucking around in the build root not the actual system.
Strictly speaking, using --reflink=auto would be useful in the spec
too, to avoid copying the files. In a build root it is very likely to
succeed too.

But you're right of course, it's kernel-install that counts.

Patches for kernel-install and dracut attached.

[Since this patch is for systemd, resending it to systemd-devel. I should
have done in the first place. If intend to push it in a few days if nobody
objects.]

Zbyszek


From 743585b006e41818c448202656396bf10e10b198 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= zbys...@in.waw.pl
Date: Sat, 9 May 2015 10:13:42 -0400
Subject: [PATCH] Use --reflink=auto in more places

---
 50-dracut.install| 2 +-
 51-dracut-rescue.install | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/50-dracut.install b/50-dracut.install
index d05abb9a57..38e672f72a 100755
--- a/50-dracut.install
+++ b/50-dracut.install
@@ -12,7 +12,7 @@ case $COMMAND in
 if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
 # we found an initrd at the same place as the kernel
 # use this and don't generate a new one
-cp $INITRD_IMAGE_PREGENERATED $BOOT_DIR_ABS/initrd \
+cp --reflink=auto $INITRD_IMAGE_PREGENERATED $BOOT_DIR_ABS/initrd \
  chown root:root $BOOT_DIR_ABS/initrd \
  chmod 0600 $BOOT_DIR_ABS/initrd \
  exit 0
diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install
index 9abd9d73ec..9152218424 100755
--- a/51-dracut-rescue.install
+++ b/51-dracut-rescue.install
@@ -71,7 +71,7 @@ case $COMMAND in
 
 [[ -d $BOOT_DIR_ABS ]] || mkdir -p $BOOT_DIR_ABS
 
-if ! cp $KERNEL_IMAGE $BOOT_DIR_ABS/linux; then
+if ! cp --reflink=auto $KERNEL_IMAGE $BOOT_DIR_ABS/linux; then
 echo Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'! 2
 fi
 
-- 
2.3.5

From 20dfba3abdf8fae0e38572180550c3ae0e4e7f97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= zbys...@in.waw.pl
Date: Sat, 9 May 2015 10:06:54 -0400
Subject: [PATCH] kernel-install: try reflinking if possible

---
 src/kernel-install/90-loaderentry.install | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
index d433e00a5c..fe8f083fc3 100644
--- a/src/kernel-install/90-loaderentry.install
+++ b/src/kernel-install/90-loaderentry.install
@@ -60,7 +60,7 @@ if ! [[ ${BOOT_OPTIONS[*]} ]]; then
 exit 1
 fi
 
-cp $KERNEL_IMAGE $BOOT_DIR_ABS/linux 
+cp --reflink=auto $KERNEL_IMAGE $BOOT_DIR_ABS/linux 
chown root:root $BOOT_DIR_ABS/linux 
chmod 0644 $BOOT_DIR_ABS/linux || {
 echo Could not copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'. 2
-- 
2.3.5

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel