- make-kmem_cache_destroy-return-void-ecryptfs.patch removed from -mm tree

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

 



The patch titled

     make-kmem_cache_destroy-return-void versus ecryptfs

has been removed from the -mm tree.  Its filename is

     make-kmem_cache_destroy-return-void-ecryptfs.patch

This patch was dropped because it was folded into ecryptfs-fs-makefile-and-fs-kconfig.patch

------------------------------------------------------
Subject: make-kmem_cache_destroy-return-void versus ecryptfs
From: Andrew Morton <akpm@xxxxxxxx>

fs/ecryptfs/main.c: In function 'ecryptfs_free_kmem_caches':
fs/ecryptfs/main.c:690: error: void value not ignored as it ought to be
fs/ecryptfs/main.c:698: error: void value not ignored as it ought to be
fs/ecryptfs/main.c:706: error: void value not ignored as it ought to be
fs/ecryptfs/main.c:714: error: void value not ignored as it ought to be
fs/ecryptfs/main.c:722: error: void value not ignored as it ought to be
fs/ecryptfs/main.c:730: error: void value not ignored as it ought to be
fs/ecryptfs/main.c:737: error: void value not ignored as it ought to be
fs/ecryptfs/main.c:744: error: void value not ignored as it ought to be
fs/ecryptfs/main.c:751: error: void value not ignored as it ought to be

That code was, err, a little verbose.  Make it table-driven.

Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Cc: Michael Halcrow <mhalcrow@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 fs/ecryptfs/main.c |  279 +++++++++++--------------------------------
 1 file changed, 77 insertions(+), 202 deletions(-)

diff -puN fs/ecryptfs/main.c~make-kmem_cache_destroy-return-void-ecryptfs fs/ecryptfs/main.c
--- a/fs/ecryptfs/main.c~make-kmem_cache_destroy-return-void-ecryptfs
+++ a/fs/ecryptfs/main.c
@@ -553,209 +553,96 @@ inode_info_init_once(void *vptr, struct 
 		inode_init_once(&ei->vfs_inode);
 }
 
-/* This provides a means of backing out cache creations out of the kernel
- * so that we can elegantly fail should we run out of memory.
- */
-#define ECRYPTFS_AUTH_TOK_LIST_ITEM_CACHE    0x0001
-#define ECRYPTFS_AUTH_TOK_PKT_SET_CACHE      0x0002
-#define ECRYPTFS_AUTH_TOK_REQUEST_CACHE      0x0004
-#define ECRYPTFS_AUTH_TOK_REQUEST_BLOB_CACHE 0x0008
-#define ECRYPTFS_FILE_INFO_CACHE             0x0010
-#define ECRYPTFS_DENTRY_INFO_CACHE           0x0020
-#define ECRYPTFS_INODE_INFO_CACHE            0x0040
-#define ECRYPTFS_SB_INFO_CACHE               0x0080
-#define ECRYPTFS_HEADER_CACHE_0              0x0100
-#define ECRYPTFS_HEADER_CACHE_1              0x0200
-#define ECRYPTFS_HEADER_CACHE_2              0x0400
-#define ECRYPTFS_LOWER_PAGE_CACHE            0x0800
-#define ECRYPTFS_CACHE_CREATION_SUCCESS      0x0FF1
-
-static short ecryptfs_allocated_caches;
+static struct ecryptfs_cache_info {
+	kmem_cache_t **cache;
+	const char *name;
+	size_t size;
+	void (*ctor)(void*, struct kmem_cache *, unsigned long);
+} ecryptfs_cache_infos[] = {
+	{
+		.cache = &ecryptfs_auth_tok_list_item_cache,
+		.name = "ecryptfs_auth_tok_list_item",
+		.size = sizeof(struct ecryptfs_auth_tok_list_item),
+	},
+	{
+		.cache = &ecryptfs_file_info_cache,
+		.name = "ecryptfs_file_cache",
+		.size = sizeof(struct ecryptfs_file_info),
+	},
+	{
+		.cache = &ecryptfs_dentry_info_cache,
+		.name = "ecryptfs_dentry_info_cache",
+		.size = sizeof(struct ecryptfs_dentry_info),
+	},
+	{
+		.cache = &ecryptfs_inode_info_cache,
+		.name = "ecryptfs_inode_cache",
+		.size = sizeof(struct ecryptfs_inode_info),
+		.ctor = inode_info_init_once,
+	},
+	{
+		.cache = &ecryptfs_sb_info_cache,
+		.name = "ecryptfs_sb_cache",
+		.size = sizeof(struct ecryptfs_sb_info),
+	},
+	{
+		.cache = &ecryptfs_header_cache_0,
+		.name = "ecryptfs_headers_0",
+		.size = PAGE_CACHE_SIZE,
+	},
+	{
+		.cache = &ecryptfs_header_cache_1,
+		.name = "ecryptfs_headers_1",
+		.size = PAGE_CACHE_SIZE,
+	},
+	{
+		.cache = &ecryptfs_header_cache_2,
+		.name = "ecryptfs_headers_2",
+		.size = PAGE_CACHE_SIZE,
+	},
+	{
+		.cache = &ecryptfs_lower_page_cache,
+		.name = "ecryptfs_lower_page_cache",
+		.size = PAGE_CACHE_SIZE,
+	},
+};
 
 /**
  * ecryptfs_init_kmem_caches
  *
- * Sets ecryptfs_allocated_caches with flags so that we can
- * free created caches should we run out of memory during
- * creation period.
- *
  * Returns zero on success; non-zero otherwise
  */
 static int ecryptfs_init_kmem_caches(void)
 {
-	int rc = 0;
+	int i;
 
-	ecryptfs_auth_tok_list_item_cache =
-	    kmem_cache_create("ecryptfs_auth_tok_list_item",
-			      sizeof(struct ecryptfs_auth_tok_list_item),
-			      0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (ecryptfs_auth_tok_list_item_cache)
-		rc |= ECRYPTFS_AUTH_TOK_LIST_ITEM_CACHE;
-	else
-		ecryptfs_printk(KERN_WARNING, "ecryptfs_auth_tok_list_item "
-				"kmem_cache_create failed\n");
-
-	ecryptfs_file_info_cache =
-	    kmem_cache_create("ecryptfs_file_cache",
-			      sizeof(struct ecryptfs_file_info),
-			      0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (ecryptfs_file_info_cache)
-		rc |= ECRYPTFS_FILE_INFO_CACHE;
-	else
-		ecryptfs_printk(KERN_WARNING, "ecryptfs_file_cache "
-				"kmem_cache_create failed\n");
-
-	ecryptfs_dentry_info_cache =
-	    kmem_cache_create("ecryptfs_dentry_info_cache",
-			      sizeof(struct ecryptfs_dentry_info),
-			      0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (ecryptfs_dentry_info_cache)
-		rc |= ECRYPTFS_DENTRY_INFO_CACHE;
-	else
-		ecryptfs_printk(KERN_WARNING, "ecryptfs_dentry_info_cache "
-				"kmem_cache_create failed\n");
-
-	ecryptfs_inode_info_cache =
-	    kmem_cache_create("ecryptfs_inode_cache",
-			      sizeof(struct ecryptfs_inode_info), 0,
-			      SLAB_HWCACHE_ALIGN, inode_info_init_once, NULL);
-	if (ecryptfs_inode_info_cache)
-		rc |= ECRYPTFS_INODE_INFO_CACHE;
-	else
-		ecryptfs_printk(KERN_WARNING, "ecryptfs_inode_cache "
-				"kmem_cache_create failed\n");
-
-	ecryptfs_sb_info_cache =
-	    kmem_cache_create("ecryptfs_sb_cache",
-			      sizeof(struct ecryptfs_sb_info),
-			      0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (ecryptfs_sb_info_cache)
-		rc |= ECRYPTFS_SB_INFO_CACHE;
-	else
-		ecryptfs_printk(KERN_WARNING, "ecryptfs_sb_cache "
-				"kmem_cache_create failed\n");
-
-	ecryptfs_header_cache_0 =
-	    kmem_cache_create("ecryptfs_headers_0", PAGE_CACHE_SIZE,
-			      0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (ecryptfs_header_cache_0)
-		rc |= ECRYPTFS_HEADER_CACHE_0;
-	else
-		ecryptfs_printk(KERN_WARNING, "ecryptfs_headers_0 "
-				"kmem_cache_create failed\n");
-
-	ecryptfs_header_cache_1 =
-	    kmem_cache_create("ecryptfs_headers_1", PAGE_CACHE_SIZE,
-			      0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (ecryptfs_header_cache_1)
-		rc |= ECRYPTFS_HEADER_CACHE_1;
-	else
-		ecryptfs_printk(KERN_WARNING, "ecryptfs_headers_1 "
-				"kmem_cache_create failed\n");
-
-	ecryptfs_header_cache_2 =
-	    kmem_cache_create("ecryptfs_headers_2", PAGE_CACHE_SIZE,
-			      0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (ecryptfs_header_cache_2)
-		rc |= ECRYPTFS_HEADER_CACHE_2;
-	else
-		ecryptfs_printk(KERN_WARNING, "ecryptfs_headers_2 "
-				"kmem_cache_create failed\n");
-
-	ecryptfs_lower_page_cache =
-	    kmem_cache_create("ecryptfs_lower_page_cache", PAGE_CACHE_SIZE,
-			      0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (ecryptfs_lower_page_cache)
-		rc |= ECRYPTFS_LOWER_PAGE_CACHE;
-	else
-		ecryptfs_printk(KERN_WARNING, "ecryptfs_lower_page_cache "
-				"kmem_cache_create failed\n");
+	for (i = 0; i < ARRAY_SIZE(ecryptfs_cache_infos); i++) {
+		struct ecryptfs_cache_info *info;
 
-	ecryptfs_allocated_caches = rc;
-	rc = ECRYPTFS_CACHE_CREATION_SUCCESS ^ rc;
-	return rc;
+		info = &ecryptfs_cache_infos[i];
+		*(info->cache) = kmem_cache_create(info->name, info->size,
+				0, SLAB_HWCACHE_ALIGN, info->ctor, NULL);
+		if (!*(info->cache)) {
+			ecryptfs_printk(KERN_WARNING, "%s: "
+					"kmem_cache_create failed\n",
+					info->name);
+			return -ENOMEM;
+		}
+	}
+	return 0;
 }
 
-/**
- * ecryptfs_free_kmem_caches
- *
- * Returns zero on success; non-zero otherwise
- */
-static int ecryptfs_free_kmem_caches(void)
+static void ecryptfs_free_kmem_caches(void)
 {
-	int rc = 0;
-	int err;
+	int i;
 
-	if (ecryptfs_allocated_caches & ECRYPTFS_AUTH_TOK_LIST_ITEM_CACHE) {
-		rc = kmem_cache_destroy(ecryptfs_auth_tok_list_item_cache);
-		if (rc)
-			ecryptfs_printk(KERN_WARNING,
-					"Not all ecryptfs_auth_tok_"
-					"list_item_cache structures were "
-					"freed\n");
-	}
-	if (ecryptfs_allocated_caches & ECRYPTFS_FILE_INFO_CACHE) {
-		err = kmem_cache_destroy(ecryptfs_file_info_cache);
-		if (err)
-			ecryptfs_printk(KERN_WARNING,
-					"Not all ecryptfs_file_info_"
-					"cache regions were freed\n");
-		rc |= err;
-	}
-	if (ecryptfs_allocated_caches & ECRYPTFS_DENTRY_INFO_CACHE) {
-		err = kmem_cache_destroy(ecryptfs_dentry_info_cache);
-		if (err)
-			ecryptfs_printk(KERN_WARNING,
-					"Not all ecryptfs_dentry_info_"
-					"cache regions were freed\n");
-		rc |= err;
-	}
-	if (ecryptfs_allocated_caches & ECRYPTFS_INODE_INFO_CACHE) {
-		err = kmem_cache_destroy(ecryptfs_inode_info_cache);
-		if (err)
-			ecryptfs_printk(KERN_WARNING,
-					"Not all ecryptfs_inode_info_"
-					"cache regions were freed\n");
-		rc |= err;
-	}
-	if (ecryptfs_allocated_caches & ECRYPTFS_SB_INFO_CACHE) {
-		err = kmem_cache_destroy(ecryptfs_sb_info_cache);
-		if (err)
-			ecryptfs_printk(KERN_WARNING,
-					"Not all ecryptfs_sb_info_"
-					"cache regions were freed\n");
-		rc |= err;
-	}
-	if (ecryptfs_allocated_caches & ECRYPTFS_HEADER_CACHE_0) {
-		err = kmem_cache_destroy(ecryptfs_header_cache_0);
-		if (err)
-			ecryptfs_printk(KERN_WARNING, "Not all ecryptfs_"
-					"header_cache_0 regions were freed\n");
-		rc |= err;
-	}
-	if (ecryptfs_allocated_caches & ECRYPTFS_HEADER_CACHE_1) {
-		err = kmem_cache_destroy(ecryptfs_header_cache_1);
-		if (err)
-			ecryptfs_printk(KERN_WARNING, "Not all ecryptfs_"
-					"header_cache_1 regions were freed\n");
-		rc |= err;
-	}
-	if (ecryptfs_allocated_caches & ECRYPTFS_HEADER_CACHE_2) {
-		err = kmem_cache_destroy(ecryptfs_header_cache_2);
-		if (err)
-			ecryptfs_printk(KERN_WARNING, "Not all ecryptfs_"
-					"header_cache_2 regions were freed\n");
-		rc |= err;
-	}
-	if (ecryptfs_allocated_caches & ECRYPTFS_LOWER_PAGE_CACHE) {
-		err = kmem_cache_destroy(ecryptfs_lower_page_cache);
-		if (err)
-			ecryptfs_printk(KERN_WARNING, "Not all ecryptfs_"
-					"lower_page_cache regions were "
-					"freed\n");
-		rc |= err;
+	for (i = 0; i < ARRAY_SIZE(ecryptfs_cache_infos); i++) {
+		struct ecryptfs_cache_info *info;
+
+		info = &ecryptfs_cache_infos[i];
+		if (*(info->cache))
+			kmem_cache_destroy(*(info->cache));
 	}
-	return rc;
 }
 
 static int __init init_ecryptfs_fs(void)
@@ -773,15 +660,8 @@ static int __init init_ecryptfs_fs(void)
 		goto out;
 	}
 	rc = ecryptfs_init_kmem_caches();
-	if (rc) {
-		ecryptfs_printk(KERN_EMERG, "Failure occured while "
-				"attempting to create caches [Mask of created "
-				"caches: 0x%x]. Now freeing caches.\n",
-				ecryptfs_allocated_caches);
-		ecryptfs_free_kmem_caches();
-		rc = -ENOMEM;
+	if (rc)
 		goto out;
-	}
 	ecryptfs_printk(KERN_DEBUG, "Registering eCryptfs\n");
 	rc = register_filesystem(&ecryptfs_fs_type);
 out:
@@ -790,13 +670,8 @@ out:
 
 static void __exit exit_ecryptfs_fs(void)
 {
-	int rc;
-
 	unregister_filesystem(&ecryptfs_fs_type);
-	rc = ecryptfs_free_kmem_caches();
-	if (rc)
-		ecryptfs_printk(KERN_EMERG, "Failure occured while "
-				"attempting to free caches: [%d]\n", rc);
+	ecryptfs_free_kmem_caches();
 }
 
 MODULE_AUTHOR("Michael A. Halcrow <mhalcrow@xxxxxxxxxx>");
_

Patches currently in -mm which might be from akpm@xxxxxxxx are

origin.patch
hdrcheck-permission-fix.patch
mmc-driver-for-ti-flashmedia-card-reader-source.patch
ecryptfs-fs-makefile-and-fs-kconfig.patch
make-kmem_cache_destroy-return-void-ecryptfs.patch
ecryptfs-versioning-fixes-tidy.patch
readahead-sysctl-parameters-fix.patch
make-copy_from_user_inatomic-not-zero-the-tail-on-i386-vs-reiser4.patch
make-kmem_cache_destroy-return-void-reiser4.patch
reiser4-hardirq-include-fix.patch
reiser4-run-truncate_inode_pages-in-reiser4_delete_inode.patch
reiser4-get_sb_dev-fix.patch
reiser4-vs-zoned-allocator.patch
reiser4-rename-generic_sounding_globalspatch-fix.patch
hpt3xx-rework-rate-filtering-tidy.patch
fbdev-riva-warning-fix.patch
genirq-convert-the-i386-architecture-to-irq-chips.patch
genirq-x86_64-irq-reenable-migrating-irqs-to-other-cpus.patch
genirq-msi-simplify-msi-enable-and-disable.patch
genirq-ia64-irq-dynamic-irq-support.patch
genirq-msi-only-build-msi-apicc-on-ia64-fix.patch
genirq-i386-irq-remove-the-msi-assumption-that-irq-==-vector.patch
genirq-x86_64-irq-make-vector_irq-per-cpu-fix.patch
genirq-x86_64-irq-make-vector_irq-per-cpu-warning-fix.patch
add-hypertransport-capability-defines-fix.patch
initial-generic-hypertransport-interrupt-support-Kconfig-fix.patch
srcu-report-out-of-memory-errors-fixlet.patch
gtod-persistent-clock-support-i386-update-fix.patch
hrtimers-state-tracking-fix.patch
clockevents-drivers-for-i386-fix.patch
debugging-feature-timer-stats-fix.patch
kevent-core-files-fix.patch
kevent-core-files-s390-hack.patch
kevent-socket-notifications-fix-2.patch
kevent-socket-notifications-fix-4.patch
nr_blockdev_pages-in_interrupt-warning.patch
device-suspend-debug.patch
slab-leaks3-default-y.patch
x86-kmap_atomic-debugging.patch
restore-rogue-readahead-printk.patch
put_bh-debug.patch
acpi_format_exception-debug.patch
jmicron-warning-fix.patch
squash-ipc-warnings.patch
squash-transmeta-warnings.patch
squash-tcp-warnings.patch
squash-udf-warnings.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux