All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove crc32c.h and use libcrc32c directly.
@ 2009-04-19 12:02 David Woodhouse
  2009-04-19 23:11 ` Chris Mason
  0 siblings, 1 reply; 5+ messages in thread
From: David Woodhouse @ 2009-04-19 12:02 UTC (permalink / raw)
  To: chris.mason; +Cc: linux-btrfs

There's no need to preserve this abstraction; it used to let us use
hardware crc32c support directly, but libcrc32c now does that for us
through the crypto API -- so we're already using the Intel crc32c
acceleration where appropriate, without having to do anything special.
As is right and proper.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
 fs/btrfs/crc32c.h      |   29 -----------------------------
 fs/btrfs/disk-io.c     |    4 ++--
 fs/btrfs/extent-tree.c |    1 -
 fs/btrfs/hash.h        |    4 ++--
 4 files changed, 4 insertions(+), 34 deletions(-)
 delete mode 100644 fs/btrfs/crc32c.h

diff --git a/fs/btrfs/crc32c.h b/fs/btrfs/crc32c.h
deleted file mode 100644
index 6e1b3de..0000000
--- a/fs/btrfs/crc32c.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2008 Oracle.  All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License v2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#ifndef __BTRFS_CRC32C__
-#define __BTRFS_CRC32C__
-#include <linux/crc32c.h>
-
-/*
- * this file used to do more for selecting the HW version of crc32c,
- * perhaps it will one day again soon.
- */
-#define btrfs_crc32c(seed, data, length) crc32c(seed, data, length)
-#endif
-
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 92caa80..ce1d8d7 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -26,8 +26,8 @@
 #include <linux/workqueue.h>
 #include <linux/kthread.h>
 #include <linux/freezer.h>
+#include <linux/crc32c.h>
 #include "compat.h"
-#include "crc32c.h"
 #include "ctree.h"
 #include "disk-io.h"
 #include "transaction.h"
@@ -172,7 +172,7 @@ out:
 
 u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len)
 {
-	return btrfs_crc32c(seed, data, len);
+	return crc32c(seed, data, len);
 }
 
 void btrfs_csum_final(u32 crc, char *result)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 178df4c..cdc4f11 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -23,7 +23,6 @@
 #include <linux/rcupdate.h>
 #include "compat.h"
 #include "hash.h"
-#include "crc32c.h"
 #include "ctree.h"
 #include "disk-io.h"
 #include "print-tree.h"
diff --git a/fs/btrfs/hash.h b/fs/btrfs/hash.h
index 2a020b2..db2ff97 100644
--- a/fs/btrfs/hash.h
+++ b/fs/btrfs/hash.h
@@ -19,9 +19,9 @@
 #ifndef __HASH__
 #define __HASH__
 
-#include "crc32c.h"
+#include <linux/crc32c.h>
 static inline u64 btrfs_name_hash(const char *name, int len)
 {
-	return btrfs_crc32c((u32)~1, name, len);
+	return crc32c((u32)~1, name, len);
 }
 #endif
-- 
1.6.2.2


-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: remove crc32c.h and use libcrc32c directly.
  2009-04-19 12:02 [PATCH] btrfs: remove crc32c.h and use libcrc32c directly David Woodhouse
@ 2009-04-19 23:11 ` Chris Mason
  2009-04-19 23:19   ` David Woodhouse
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Mason @ 2009-04-19 23:11 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-btrfs

On Sun, 2009-04-19 at 13:02 +0100, David Woodhouse wrote:
> There's no need to preserve this abstraction; it used to let us use
> hardware crc32c support directly, but libcrc32c now does that for us
> through the crypto API -- so we're already using the Intel crc32c
> acceleration where appropriate, without having to do anything special.
> As is right and proper.
> 

How does this enable the HW crc32c?  Unless I'm missing something you're
doing crc32c instead of btrfs_crc32c, but btrfs_crc32c was #defined to
crc32c?

-chris

> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
> ---
>  fs/btrfs/crc32c.h      |   29 -----------------------------
>  fs/btrfs/disk-io.c     |    4 ++--
>  fs/btrfs/extent-tree.c |    1 -
>  fs/btrfs/hash.h        |    4 ++--
>  4 files changed, 4 insertions(+), 34 deletions(-)
>  delete mode 100644 fs/btrfs/crc32c.h
> 
> diff --git a/fs/btrfs/crc32c.h b/fs/btrfs/crc32c.h
> deleted file mode 100644
> index 6e1b3de..0000000
> --- a/fs/btrfs/crc32c.h
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/*
> - * Copyright (C) 2008 Oracle.  All rights reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public
> - * License v2 as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> - * General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public
> - * License along with this program; if not, write to the
> - * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
> - * Boston, MA 021110-1307, USA.
> - */
> -
> -#ifndef __BTRFS_CRC32C__
> -#define __BTRFS_CRC32C__
> -#include <linux/crc32c.h>
> -
> -/*
> - * this file used to do more for selecting the HW version of crc32c,
> - * perhaps it will one day again soon.
> - */
> -#define btrfs_crc32c(seed, data, length) crc32c(seed, data, length)
> -#endif
> -
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 92caa80..ce1d8d7 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -26,8 +26,8 @@
>  #include <linux/workqueue.h>
>  #include <linux/kthread.h>
>  #include <linux/freezer.h>
> +#include <linux/crc32c.h>
>  #include "compat.h"
> -#include "crc32c.h"
>  #include "ctree.h"
>  #include "disk-io.h"
>  #include "transaction.h"
> @@ -172,7 +172,7 @@ out:
>  
>  u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len)
>  {
> -	return btrfs_crc32c(seed, data, len);
> +	return crc32c(seed, data, len);
>  }
>  
>  void btrfs_csum_final(u32 crc, char *result)
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 178df4c..cdc4f11 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -23,7 +23,6 @@
>  #include <linux/rcupdate.h>
>  #include "compat.h"
>  #include "hash.h"
> -#include "crc32c.h"
>  #include "ctree.h"
>  #include "disk-io.h"
>  #include "print-tree.h"
> diff --git a/fs/btrfs/hash.h b/fs/btrfs/hash.h
> index 2a020b2..db2ff97 100644
> --- a/fs/btrfs/hash.h
> +++ b/fs/btrfs/hash.h
> @@ -19,9 +19,9 @@
>  #ifndef __HASH__
>  #define __HASH__
>  
> -#include "crc32c.h"
> +#include <linux/crc32c.h>
>  static inline u64 btrfs_name_hash(const char *name, int len)
>  {
> -	return btrfs_crc32c((u32)~1, name, len);
> +	return crc32c((u32)~1, name, len);
>  }
>  #endif
> -- 
> 1.6.2.2
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: remove crc32c.h and use libcrc32c directly.
  2009-04-19 23:11 ` Chris Mason
@ 2009-04-19 23:19   ` David Woodhouse
  2009-04-19 23:30     ` Chris Mason
  0 siblings, 1 reply; 5+ messages in thread
From: David Woodhouse @ 2009-04-19 23:19 UTC (permalink / raw)
  To: Chris Mason; +Cc: linux-btrfs

On Sun, 2009-04-19 at 19:11 -0400, Chris Mason wrote:
> How does this enable the HW crc32c?  Unless I'm missing something you're
> doing crc32c instead of btrfs_crc32c, but btrfs_crc32c was #defined to
> crc32c?

It doesn't. You're _already_ using the hardware crc32c.

Since commit  69c35efc, all users of crc32c() in libcrc32c are actually
using the cryptoapi and thus any accelerated hardware implementations
that are available:

    libcrc32c: Move implementation to crypto crc32c
    
    This patch swaps the role of libcrc32c and crc32c.  Previously
    the implementation was in libcrc32c and crc32c was a wrapper.
    Now the code is in crc32c and libcrc32c just calls the crypto
    layer.
    
    The reason for the change is to tap into the algorithm selection
    capability of the crypto API so that optimised implementations
    such as the one utilising Intel's CRC32C instruction can be
    used where available.
    
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: remove crc32c.h and use libcrc32c directly.
  2009-04-19 23:19   ` David Woodhouse
@ 2009-04-19 23:30     ` Chris Mason
  2009-04-19 23:41       ` David Woodhouse
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Mason @ 2009-04-19 23:30 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-btrfs

On Mon, 2009-04-20 at 00:19 +0100, David Woodhouse wrote:
> On Sun, 2009-04-19 at 19:11 -0400, Chris Mason wrote:
> > How does this enable the HW crc32c?  Unless I'm missing something you're
> > doing crc32c instead of btrfs_crc32c, but btrfs_crc32c was #defined to
> > crc32c?
> 
> It doesn't. You're _already_ using the hardware crc32c.
> 

Ok, that makes more sense ;) I'll fixup the changelog when I merge the
patch.  I didn't have the HW crc enabled in my config, so it wasn't
switching over.

-chris



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: remove crc32c.h and use libcrc32c directly.
  2009-04-19 23:30     ` Chris Mason
@ 2009-04-19 23:41       ` David Woodhouse
  0 siblings, 0 replies; 5+ messages in thread
From: David Woodhouse @ 2009-04-19 23:41 UTC (permalink / raw)
  To: Chris Mason; +Cc: linux-btrfs

On Sun, 2009-04-19 at 19:30 -0400, Chris Mason wrote:
> On Mon, 2009-04-20 at 00:19 +0100, David Woodhouse wrote:
> > On Sun, 2009-04-19 at 19:11 -0400, Chris Mason wrote:
> > > How does this enable the HW crc32c?  Unless I'm missing something you're
> > > doing crc32c instead of btrfs_crc32c, but btrfs_crc32c was #defined to
> > > crc32c?
> > 
> > It doesn't. You're _already_ using the hardware crc32c.
> > 
> 
> Ok, that makes more sense ;) I'll fixup the changelog when I merge the
> patch. 

The changelog already said "libcrc32c now does that for us
through the crypto API -- so we're already using the Intel crc32c
acceleration where appropriate, without having to do anything special."

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-04-19 23:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-19 12:02 [PATCH] btrfs: remove crc32c.h and use libcrc32c directly David Woodhouse
2009-04-19 23:11 ` Chris Mason
2009-04-19 23:19   ` David Woodhouse
2009-04-19 23:30     ` Chris Mason
2009-04-19 23:41       ` David Woodhouse

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.