drbd: Silenced compiler warnings
authorPhilipp Reisner <philipp.reisner@linbit.com>
Mon, 7 Nov 2011 09:54:28 +0000 (10:54 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 8 Nov 2012 15:58:05 +0000 (16:58 +0100)
Since version 4.6.1 gcc warns about variables that get
a value assigned, but which are never read later on.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_actlog.c
drivers/block/drbd/drbd_receiver.c
drivers/block/drbd/drbd_req.c
drivers/block/drbd/drbd_state.c

index 4dd52088f2419476668d8ad2a9abc38281333b15..ade79be4e27a61d7d44711f6a30187c187b3a3cc 100644 (file)
@@ -264,8 +264,7 @@ void drbd_al_begin_io(struct drbd_conf *mdev, struct drbd_interval *i)
                /* Double check: it may have been committed by someone else,
                 * while we have been waiting for the lock. */
                if (mdev->act_log->pending_changes) {
-                       int err;
-                       err = al_write_transaction(mdev);
+                       al_write_transaction(mdev);
                        mdev->al_writ_cnt++;
 
                        spin_lock_irq(&mdev->al_lock);
@@ -290,7 +289,6 @@ void drbd_al_complete_io(struct drbd_conf *mdev, struct drbd_interval *i)
        unsigned enr;
        struct lc_element *extent;
        unsigned long flags;
-       bool wake = false;
 
        spin_lock_irqsave(&mdev->al_lock, flags);
 
@@ -300,8 +298,7 @@ void drbd_al_complete_io(struct drbd_conf *mdev, struct drbd_interval *i)
                        dev_err(DEV, "al_complete_io() called on inactive extent %u\n", enr);
                        continue;
                }
-               if (lc_put(mdev->act_log, extent) == 0)
-                       wake = true;
+               lc_put(mdev->act_log, extent);
        }
        spin_unlock_irqrestore(&mdev->al_lock, flags);
        wake_up(&mdev->al_wait);
@@ -730,7 +727,7 @@ void __drbd_set_in_sync(struct drbd_conf *mdev, sector_t sector, int size,
 int __drbd_set_out_of_sync(struct drbd_conf *mdev, sector_t sector, int size,
                            const char *file, const unsigned int line)
 {
-       unsigned long sbnr, ebnr, lbnr, flags;
+       unsigned long sbnr, ebnr, flags;
        sector_t esector, nr_sectors;
        unsigned int enr, count = 0;
        struct lc_element *e;
@@ -752,8 +749,6 @@ int __drbd_set_out_of_sync(struct drbd_conf *mdev, sector_t sector, int size,
        if (!expect(esector < nr_sectors))
                esector = nr_sectors - 1;
 
-       lbnr = BM_SECT_TO_BIT(nr_sectors-1);
-
        /* we set it out of sync,
         * we do not need to round anything here */
        sbnr = BM_SECT_TO_BIT(sector);
index aba04d7dadf50da51e7782259cbc9788d2837bb2..e823968f1cd2a8b1f54e3191dfdb4e91da70beb3 100644 (file)
@@ -4324,7 +4324,7 @@ static void conn_disconnect(struct drbd_tconn *tconn)
 {
        struct drbd_conf *mdev;
        enum drbd_conns oc;
-       int vnr, rv = SS_UNKNOWN_ERROR;
+       int vnr;
 
        if (tconn->cstate == C_STANDALONE)
                return;
@@ -4351,7 +4351,7 @@ static void conn_disconnect(struct drbd_tconn *tconn)
        spin_lock_irq(&tconn->req_lock);
        oc = tconn->cstate;
        if (oc >= C_UNCONNECTED)
-               rv = _conn_request_state(tconn, NS(conn, C_UNCONNECTED), CS_VERBOSE);
+               _conn_request_state(tconn, NS(conn, C_UNCONNECTED), CS_VERBOSE);
 
        spin_unlock_irq(&tconn->req_lock);
 
@@ -4361,7 +4361,6 @@ static void conn_disconnect(struct drbd_tconn *tconn)
 
 static int drbd_disconnected(struct drbd_conf *mdev)
 {
-       enum drbd_fencing_p fp;
        unsigned int i;
 
        /* wait for current activity to cease. */
@@ -4405,14 +4404,6 @@ static int drbd_disconnected(struct drbd_conf *mdev)
 
        drbd_md_sync(mdev);
 
-       fp = FP_DONT_CARE;
-       if (get_ldev(mdev)) {
-               rcu_read_lock();
-               fp = rcu_dereference(mdev->ldev->disk_conf)->fencing;
-               rcu_read_unlock();
-               put_ldev(mdev);
-       }
-
        /* serialize with bitmap writeout triggered by the state change,
         * if any. */
        wait_event(mdev->misc_wait, !test_bit(BITMAP_IO, &mdev->flags));
index d61309db14a2526c084e6799a6b921b8e86cd9ac..42bdf36cef182a073c86e4e3645628c27e1aa482 100644 (file)
@@ -39,6 +39,8 @@ static void _drbd_start_io_acct(struct drbd_conf *mdev, struct drbd_request *req
        cpu = part_stat_lock();
        part_stat_inc(cpu, &mdev->vdisk->part0, ios[rw]);
        part_stat_add(cpu, &mdev->vdisk->part0, sectors[rw], bio_sectors(bio));
+       (void) cpu; /* The macro invocations above want the cpu argument, I do not like
+                      the compiler warning about cpu only assigned but never used... */
        part_inc_in_flight(&mdev->vdisk->part0, rw);
        part_stat_unlock();
 }
index 9aefca69e4e76e69b5ebc08b74ce7f639c561af0..4075bd2d2515780cd44f66d7d71ea31f264b4720 100644 (file)
@@ -1143,7 +1143,6 @@ int drbd_bitmap_io_from_worker(struct drbd_conf *mdev,
 static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
                           union drbd_state ns, enum chg_state_flags flags)
 {
-       enum drbd_fencing_p fp;
        struct sib_info sib;
 
        sib.sib_reason = SIB_STATE_CHANGE;
@@ -1156,14 +1155,6 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
                        mdev->p_uuid[UI_FLAGS] &= ~((u64)2);
        }
 
-       fp = FP_DONT_CARE;
-       if (get_ldev(mdev)) {
-               rcu_read_lock();
-               fp = rcu_dereference(mdev->ldev->disk_conf)->fencing;
-               rcu_read_unlock();
-               put_ldev(mdev);
-       }
-
        /* Inform userspace about the change... */
        drbd_bcast_event(mdev, &sib);