[DRBD-cvs] svn commit by phil - r2778 - trunk/drbd - * Removed two
compiler warnings, that get displayes by
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Fri Mar 2 15:41:16 CET 2007
Author: phil
Date: 2007-03-02 15:41:13 +0100 (Fri, 02 Mar 2007)
New Revision: 2778
Modified:
trunk/drbd/cn_queue.c
trunk/drbd/drbd_actlog.c
trunk/drbd/drbd_bitmap.c
trunk/drbd/drbd_compat_wrappers.h
trunk/drbd/drbd_main.c
trunk/drbd/drbd_nl.c
trunk/drbd/drbd_receiver.c
Log:
* Removed two compiler warnings, that get displayes by gcc-4.1
* Use kzalloc() instead of kmalloc() + memset()
Modified: trunk/drbd/cn_queue.c
===================================================================
--- trunk/drbd/cn_queue.c 2007-03-02 12:19:16 UTC (rev 2777)
+++ trunk/drbd/cn_queue.c 2007-03-02 14:41:13 UTC (rev 2778)
@@ -49,13 +49,12 @@
{
struct cn_callback_entry *cbq;
- cbq = kmalloc(sizeof(*cbq), GFP_KERNEL);
+ cbq = kzalloc(sizeof(*cbq), GFP_KERNEL);
if (!cbq) {
printk(KERN_ERR "Failed to create new callback queue.\n");
return NULL;
}
- memset(cbq,0,sizeof(*cbq));
snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name);
memcpy(&cbq->id.id, id, sizeof(struct cb_id));
cbq->data.callback = callback;
@@ -138,11 +137,10 @@
{
struct cn_queue_dev *dev;
- dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev)
return NULL;
- memset(dev,0,sizeof(*dev));
snprintf(dev->name, sizeof(dev->name), "%s", name);
atomic_set(&dev->refcnt, 0);
INIT_LIST_HEAD(&dev->queue_list);
Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c 2007-03-02 12:19:16 UTC (rev 2777)
+++ trunk/drbd/drbd_actlog.c 2007-03-02 14:41:13 UTC (rev 2778)
@@ -651,9 +651,8 @@
unsigned int page_offset=PAGE_SIZE;
struct drbd_atodb_wait wc;
- bios = kmalloc(sizeof(struct bio*) * mdev->act_log->nr_elements,
+ bios = kzalloc(sizeof(struct bio*) * mdev->act_log->nr_elements,
GFP_KERNEL);
- memset(bios,0,sizeof(struct bio*) * mdev->act_log->nr_elements);
if(!bios) {
drbd_al_to_on_disk_bm_slow(mdev);
Modified: trunk/drbd/drbd_bitmap.c
===================================================================
--- trunk/drbd/drbd_bitmap.c 2007-03-02 12:19:16 UTC (rev 2777)
+++ trunk/drbd/drbd_bitmap.c 2007-03-02 14:41:13 UTC (rev 2778)
@@ -244,10 +244,9 @@
{
struct drbd_bitmap *b = mdev->bitmap;
D_BUG_ON(b);
- b = kmalloc(sizeof(struct drbd_bitmap),GFP_KERNEL);
+ b = kzalloc(sizeof(struct drbd_bitmap),GFP_KERNEL);
if (!b)
return -ENOMEM;
- memset(b,0,sizeof(*b));
spin_lock_init(&b->bm_lock);
init_MUTEX(&b->bm_change);
init_waitqueue_head(&b->bm_io_wait);
Modified: trunk/drbd/drbd_compat_wrappers.h
===================================================================
--- trunk/drbd/drbd_compat_wrappers.h 2007-03-02 12:19:16 UTC (rev 2777)
+++ trunk/drbd/drbd_compat_wrappers.h 2007-03-02 14:41:13 UTC (rev 2778)
@@ -327,3 +327,13 @@
}
#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+static inline void *kzalloc(size_t size, int flags)
+{
+ void *rv = kmalloc(size,flags);
+ if(rv) memset(rv,0,size);
+
+ return rv;
+}
+#endif
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2007-03-02 12:19:16 UTC (rev 2777)
+++ trunk/drbd/drbd_main.c 2007-03-02 14:41:13 UTC (rev 2778)
@@ -2280,9 +2280,8 @@
struct gendisk *disk;
request_queue_t *q;
- mdev = kmalloc(sizeof(drbd_dev),GFP_KERNEL);
+ mdev = kzalloc(sizeof(drbd_dev),GFP_KERNEL);
if(!mdev) goto Enomem;
- memset(mdev,0,sizeof(drbd_dev ));
mdev->minor = minor;
@@ -2325,9 +2324,8 @@
// no need to lock access, we are still initializing the module.
if (!tl_init(mdev)) goto Enomem;
- mdev->app_reads_hash=kmalloc(APP_R_HSIZE*sizeof(void*),GFP_KERNEL);
+ mdev->app_reads_hash=kzalloc(APP_R_HSIZE*sizeof(void*),GFP_KERNEL);
if (!mdev->app_reads_hash) goto Enomem;
- memset(mdev->app_reads_hash,0,APP_R_HSIZE*sizeof(void*));
return mdev;
@@ -2419,9 +2417,8 @@
init_waitqueue_head(&drbd_pp_wait);
drbd_proc = NULL; // play safe for drbd_cleanup
- minor_table = kmalloc(sizeof(drbd_dev *)*minor_count,GFP_KERNEL);
+ minor_table = kzalloc(sizeof(drbd_dev *)*minor_count,GFP_KERNEL);
if(!minor_table) goto Enomem;
- memset(minor_table,0,sizeof(drbd_dev *)*minor_count);
if ((err = drbd_create_mempools()))
goto Enomem;
Modified: trunk/drbd/drbd_nl.c
===================================================================
--- trunk/drbd/drbd_nl.c 2007-03-02 12:19:16 UTC (rev 2777)
+++ trunk/drbd/drbd_nl.c 2007-03-02 14:41:13 UTC (rev 2778)
@@ -1104,22 +1104,20 @@
ns = new_conf->max_epoch_size/8;
if (mdev->tl_hash_s != ns) {
- new_tl_hash=kmalloc(ns*sizeof(void*), GFP_KERNEL);
+ new_tl_hash=kzalloc(ns*sizeof(void*), GFP_KERNEL);
if(!new_tl_hash) {
retcode=KMallocFailed;
goto fail;
}
- memset(new_tl_hash, 0, ns*sizeof(void*));
}
ns = new_conf->max_buffers/8;
if (new_conf->two_primaries && ( mdev->ee_hash_s != ns ) ) {
- new_ee_hash=kmalloc(ns*sizeof(void*), GFP_KERNEL);
+ new_ee_hash=kzalloc(ns*sizeof(void*), GFP_KERNEL);
if(!new_ee_hash) {
retcode=KMallocFailed;
goto fail;
}
- memset(new_ee_hash, 0, ns*sizeof(void*));
}
((char*)new_conf->shared_secret)[SHARED_SECRET_MAX-1]=0;
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2007-03-02 12:19:16 UTC (rev 2777)
+++ trunk/drbd/drbd_receiver.c 2007-03-02 14:41:13 UTC (rev 2778)
@@ -237,6 +237,7 @@
unsigned int data_size,
unsigned int gfp_mask)
{
+ request_queue_t *q;
struct Tl_epoch_entry* e;
struct bio_vec *bvec;
struct page *page;
@@ -272,7 +273,7 @@
"data_size=%u,ds=%u) failed\n",
(unsigned long long)sector, data_size, ds);
- request_queue_t *q = bdev_get_queue(bio->bi_bdev);
+ q = bdev_get_queue(bio->bi_bdev);
if (q->merge_bvec_fn) {
ERR("merge_bvec_fn() = %d\n",
q->merge_bvec_fn(q, bio,
@@ -2225,7 +2226,8 @@
if (mdev->state.conn == WFReportParams) {
/* this is first connect, or an otherwise expected
param exchange. choose the minimum */
- p_usize = min_not_zero(mdev->bc->dc.disk_size, p_usize);
+ p_usize=min_not_zero((sector_t)mdev->bc->dc.disk_size,
+ p_usize);
}
my_usize = mdev->bc->dc.disk_size;
More information about the drbd-cvs
mailing list