From: "Nitin Gupta" <nitingupta910@gmail.com>
To: Will Newton <will.newton@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/6] compcache: compressed RAM block device
Date: Tue, 25 Mar 2008 00:05:24 +0530 [thread overview]
Message-ID: <4cefeab80803241135i70bd81e5od82b84685bc4dbb@mail.gmail.com> (raw)
In-Reply-To: <87a5b0800803240923m1ec9e343ld08c2828fe42e4e@mail.gmail.com>
On Mon, Mar 24, 2008 at 9:53 PM, Will Newton <will.newton@gmail.com> wrote:
>
> On Mon, Mar 24, 2008 at 3:02 PM, Nitin Gupta <nitingupta910@gmail.com> wrote:
> > diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> > index 5e58430..b6d3dd2 100644
> > --- a/drivers/block/Makefile
> > +++ b/drivers/block/Makefile
> > @@ -12,6 +12,7 @@ obj-$(CONFIG_PS3_DISK) += ps3disk.o
> > obj-$(CONFIG_ATARI_FLOPPY) += ataflop.o
> > obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o
> > obj-$(CONFIG_BLK_DEV_RAM) += brd.o
> > +obj-$(CONFIG_BLK_DEV_COMPCACHE) += compcache.o
>
> Minor - this isn't in alphabetical order.
Intent here is to keep related things together. So, I have placed it
with generic ramdisk. This also seems to be convention used in this
file.
> > diff --git a/drivers/block/compcache.c b/drivers/block/compcache.c
> > new file mode 100644
> > index 0000000..4ffcd63
> > --- /dev/null
> > +++ b/drivers/block/compcache.c
> > @@ -0,0 +1,440 @@
> > +/*
> > + * Compressed RAM based swap device
> > + *
> > + * (C) Nitin Gupta
>
> Should add a copyright year.
>
ok.
> > +#include <asm/string.h>
>
> Should this be <linux/string.h>?
>
Yes. I will change this.
> > +/* Check if request is within bounds and page aligned */
> > +static inline int valid_swap_request(struct bio *bio)
> > +{
> > + if (unlikely((bio->bi_sector >= compcache.size) ||
> > + (bio->bi_sector & (SECTORS_PER_PAGE - 1)) ||
> > + (bio->bi_vcnt != 1) ||
> > + (bio->bi_size != PAGE_SIZE) ||
> > + (bio->bi_io_vec[0].bv_offset != 0)))
> > + return 0;
> > + return 1;
> > +}
>
> Probably unnecessary to mark this explicitly inline.
>
>
Probably yes. I am not sure.
> > + /*
> > + * It is named like this to prevent distro installers
> > + * from offering compcache as installation target. They
> > + * seem to ignore all devices beginning with 'ram'
> > + */
> > + sprintf(compcache.disk->disk_name, "%s", "ramzswap0");
>
> I'm not sure the name makes it 100% obvious what the device is for.
> You could use strcpy here also.
>
"z" == compress
and hence the name ramzswap :)
> > + if (compcache.table[0].addr)
> > + free_page((unsigned long)compcache.table[0].addr);
> > + if (compcache.compress_workmem)
> > + kfree(compcache.compress_workmem);
> > + if (compcache.compress_buffer)
> > + kfree(compcache.compress_buffer);
> > + if (compcache.table)
> > + vfree(compcache.table);
>
> kfree() and vfree() may safely be called on NULL pointers.
>
I will remove these unnecessary checks then.
Thanks,
Nitin
--
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:[~2008-03-24 18:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-24 15:02 Nitin Gupta
2008-03-24 16:23 ` Will Newton
2008-03-24 18:35 ` Nitin Gupta [this message]
2008-03-26 22:19 ` Pavel Machek
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=4cefeab80803241135i70bd81e5od82b84685bc4dbb@mail.gmail.com \
--to=nitingupta910@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=will.newton@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox