From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: Nitin Gupta <ngupta@vflare.org>
Cc: Greg KH <greg@kroah.com>,
Andrew Morton <akpm@linux-foundation.org>,
Pekka Enberg <penberg@cs.helsinki.fi>, Ed Tomlinson <edt@aei.ca>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
linux-mm-cc <linux-mm-cc@laptop.org>
Subject: Re: [PATCH 3/4] virtual block device driver (ramzswap)
Date: Fri, 18 Sep 2009 22:48:39 +0200 [thread overview]
Message-ID: <4AB3F227.3030602@gmail.com> (raw)
In-Reply-To: <1253227412-24342-4-git-send-email-ngupta@vflare.org>
Nitin Gupta wrote:
> (...)
> +
> +static int page_zero_filled(void *ptr)
> +{
> + u32 pos;
> + u64 *page;
> +
> + page = (u64 *)ptr;
> +
> + for (pos = 0; pos != PAGE_SIZE / sizeof(*page); pos++) {
> + if (page[pos])
> + return 0;
> + }
> +
> + return 1;
> +}
Wouldn't unsigned long *page be better for both 32-bit and 64-bit machines?
(This function could return bool)
> (...)
> +static void create_device(struct ramzswap *rzs, int device_id)
> +{
> + mutex_init(&rzs->lock);
> + INIT_LIST_HEAD(&rzs->backing_swap_extent_list);
> +
> + rzs->queue = blk_alloc_queue(GFP_KERNEL);
> + if (!rzs->queue) {
> + pr_err("Error allocating disk queue for device %d\n",
> + device_id);
> + return;
> + }
> +
> + blk_queue_make_request(rzs->queue, ramzswap_make_request);
> + rzs->queue->queuedata = rzs;
> +
> + /* gendisk structure */
> + rzs->disk = alloc_disk(1);
> + if (!rzs->disk) {
> + blk_cleanup_queue(rzs->queue);
> + pr_warning("Error allocating disk structure for device %d\n",
> + device_id);
> + return;
> + }
> +
> + rzs->disk->major = ramzswap_major;
> + rzs->disk->first_minor = device_id;
> + rzs->disk->fops = &ramzswap_devops;
> + rzs->disk->queue = rzs->queue;
> + rzs->disk->private_data = rzs;
> + snprintf(rzs->disk->disk_name, 16, "ramzswap%d", device_id);
> +
> + /*
> + * Actual capacity set using RZSIO_SET_DISKSIZE_KB ioctl
> + * or set equal to backing swap device (if provided)
> + */
> + set_capacity(rzs->disk, 0);
> + add_disk(rzs->disk);
> +
> + rzs->init_done = 0;
> +
> + return;
> +}
needless return
Marcin
WARNING: multiple messages have this Message-ID (diff)
From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: Nitin Gupta <ngupta@vflare.org>
Cc: Greg KH <greg@kroah.com>,
Andrew Morton <akpm@linux-foundation.org>,
Pekka Enberg <penberg@cs.helsinki.fi>, Ed Tomlinson <edt@aei.ca>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
linux-mm-cc <linux-mm-cc@laptop.org>
Subject: Re: [PATCH 3/4] virtual block device driver (ramzswap)
Date: Fri, 18 Sep 2009 22:48:39 +0200 [thread overview]
Message-ID: <4AB3F227.3030602@gmail.com> (raw)
In-Reply-To: <1253227412-24342-4-git-send-email-ngupta@vflare.org>
Nitin Gupta wrote:
> (...)
> +
> +static int page_zero_filled(void *ptr)
> +{
> + u32 pos;
> + u64 *page;
> +
> + page = (u64 *)ptr;
> +
> + for (pos = 0; pos != PAGE_SIZE / sizeof(*page); pos++) {
> + if (page[pos])
> + return 0;
> + }
> +
> + return 1;
> +}
Wouldn't unsigned long *page be better for both 32-bit and 64-bit machines?
(This function could return bool)
> (...)
> +static void create_device(struct ramzswap *rzs, int device_id)
> +{
> + mutex_init(&rzs->lock);
> + INIT_LIST_HEAD(&rzs->backing_swap_extent_list);
> +
> + rzs->queue = blk_alloc_queue(GFP_KERNEL);
> + if (!rzs->queue) {
> + pr_err("Error allocating disk queue for device %d\n",
> + device_id);
> + return;
> + }
> +
> + blk_queue_make_request(rzs->queue, ramzswap_make_request);
> + rzs->queue->queuedata = rzs;
> +
> + /* gendisk structure */
> + rzs->disk = alloc_disk(1);
> + if (!rzs->disk) {
> + blk_cleanup_queue(rzs->queue);
> + pr_warning("Error allocating disk structure for device %d\n",
> + device_id);
> + return;
> + }
> +
> + rzs->disk->major = ramzswap_major;
> + rzs->disk->first_minor = device_id;
> + rzs->disk->fops = &ramzswap_devops;
> + rzs->disk->queue = rzs->queue;
> + rzs->disk->private_data = rzs;
> + snprintf(rzs->disk->disk_name, 16, "ramzswap%d", device_id);
> +
> + /*
> + * Actual capacity set using RZSIO_SET_DISKSIZE_KB ioctl
> + * or set equal to backing swap device (if provided)
> + */
> + set_capacity(rzs->disk, 0);
> + add_disk(rzs->disk);
> +
> + rzs->init_done = 0;
> +
> + return;
> +}
needless return
Marcin
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-09-18 20:48 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-17 22:43 [PATCH 0/4] compcache: in-memory compressed swapping v3 Nitin Gupta
2009-09-17 22:43 ` Nitin Gupta
2009-09-17 22:43 ` [PATCH 1/4] xvmalloc memory allocator Nitin Gupta
2009-09-17 22:43 ` Nitin Gupta
2009-09-18 21:05 ` Marcin Slusarz
2009-09-18 21:05 ` Marcin Slusarz
2009-09-22 3:50 ` Nitin Gupta
2009-09-22 3:50 ` Nitin Gupta
2009-09-17 22:43 ` [PATCH 2/4] send callback when swap slot is freed Nitin Gupta
2009-09-17 22:43 ` Nitin Gupta
2009-09-18 6:53 ` Pekka Enberg
2009-09-18 6:53 ` Pekka Enberg
2009-09-18 7:17 ` Hugh Dickins
2009-09-18 7:17 ` Hugh Dickins
2009-09-18 7:55 ` Pekka Enberg
2009-09-18 7:55 ` Pekka Enberg
2009-09-18 7:59 ` Hugh Dickins
2009-09-18 7:59 ` Hugh Dickins
2009-09-18 9:33 ` Pekka Enberg
2009-09-18 9:33 ` Pekka Enberg
2009-09-18 15:04 ` Nitin Gupta
2009-09-18 15:04 ` Nitin Gupta
2009-09-19 7:27 ` Pekka Enberg
2009-09-19 7:27 ` Pekka Enberg
2009-09-20 15:02 ` Nitin Gupta
2009-09-20 15:02 ` Nitin Gupta
2009-09-21 11:17 ` Hugh Dickins
2009-09-21 11:17 ` Hugh Dickins
2009-09-21 11:07 ` Hugh Dickins
2009-09-21 11:07 ` Hugh Dickins
2009-09-21 11:12 ` Pekka Enberg
2009-09-21 11:12 ` Pekka Enberg
2009-09-21 11:55 ` Hugh Dickins
2009-09-21 11:55 ` Hugh Dickins
2009-09-21 12:01 ` Pekka Enberg
2009-09-21 12:01 ` Pekka Enberg
2009-09-22 3:04 ` Nitin Gupta
2009-09-22 3:04 ` Nitin Gupta
2009-09-21 12:08 ` Pekka Enberg
2009-09-21 12:08 ` Pekka Enberg
2009-09-21 12:29 ` Nitin Gupta
2009-09-21 12:29 ` Nitin Gupta
2009-09-18 9:59 ` Nitin Gupta
2009-09-18 9:59 ` Nitin Gupta
2009-09-19 5:47 ` Nitin Gupta
2009-09-19 5:47 ` Nitin Gupta
2009-09-24 1:39 ` KAMEZAWA Hiroyuki
2009-09-24 1:39 ` KAMEZAWA Hiroyuki
2009-09-17 22:43 ` [PATCH 3/4] virtual block device driver (ramzswap) Nitin Gupta
2009-09-17 22:43 ` Nitin Gupta
2009-09-18 20:48 ` Marcin Slusarz [this message]
2009-09-18 20:48 ` Marcin Slusarz
2009-09-17 22:43 ` [PATCH 4/4] documentation Nitin Gupta
2009-09-17 22:43 ` Nitin Gupta
2009-09-18 16:43 ` [PATCH] ramzswap prefix for swap free callback Nitin Gupta
2009-09-18 16:43 ` Nitin Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AB3F227.3030602@gmail.com \
--to=marcin.slusarz@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=edt@aei.ca \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm-cc@laptop.org \
--cc=linux-mm@kvack.org \
--cc=ngupta@vflare.org \
--cc=penberg@cs.helsinki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.