]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drbd: Get rid of unnecessary macros (2)
authorAndreas Gruenbacher <agruen@linbit.com>
Tue, 7 Dec 2010 09:43:29 +0000 (10:43 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Mar 2011 10:36:15 +0000 (11:36 +0100)
The FAULT_ACTIVE macro just wraps the drbd_insert_fault macro for no
apparent reason.

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_bitmap.c
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_receiver.c
drivers/block/drbd/drbd_req.c
drivers/block/drbd/drbd_wrappers.h

index 4a1b199f4ae72c2f0f1db4b0c72bcf72d2d108ca..2e8a95ce79b15acb971ff400127a93cc9cf9c0d4 100644 (file)
@@ -92,7 +92,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
        bio->bi_end_io = drbd_md_io_complete;
        bio->bi_rw = rw;
 
-       if (FAULT_ACTIVE(mdev, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD))
+       if (drbd_insert_fault(mdev, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD))
                bio_endio(bio, -EIO);
        else
                submit_bio(rw, bio);
@@ -685,7 +685,7 @@ void drbd_al_to_on_disk_bm(struct drbd_conf *mdev)
        for (i = 0; i < nr_elements; i++) {
                if (bios[i] == NULL)
                        break;
-               if (FAULT_ACTIVE(mdev, DRBD_FAULT_MD_WR)) {
+               if (drbd_insert_fault(mdev, DRBD_FAULT_MD_WR)) {
                        bios[i]->bi_rw = WRITE;
                        bio_endio(bios[i], -EIO);
                } else {
index 0645ca829a94163c57f4ee5ac43e96aaa344870d..5dafbabe961707392969763f65343987ca5ca94e 100644 (file)
@@ -502,7 +502,7 @@ int drbd_bm_resize(struct drbd_conf *mdev, sector_t capacity, int set_new_bits)
                D_ASSERT(b->bm_pages != NULL);
                npages = b->bm_pages;
        } else {
-               if (FAULT_ACTIVE(mdev, DRBD_FAULT_BM_ALLOC))
+               if (drbd_insert_fault(mdev, DRBD_FAULT_BM_ALLOC))
                        npages = NULL;
                else
                        npages = bm_realloc_pages(b, want);
@@ -768,7 +768,7 @@ static void bm_page_io_async(struct drbd_conf *mdev, struct drbd_bitmap *b, int
        bio->bi_private = b;
        bio->bi_end_io = bm_async_io_complete;
 
-       if (FAULT_ACTIVE(mdev, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD)) {
+       if (drbd_insert_fault(mdev, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD)) {
                bio->bi_rw |= rw;
                bio_endio(bio, -EIO);
        } else {
index 7514cf7a958cf4b6fbbdeae17862c5fd97c36bee..c81710a42111de887ce9465308a5d698f074e5d7 100644 (file)
@@ -137,20 +137,19 @@ enum {
        DRBD_FAULT_MAX,
 };
 
-#ifdef CONFIG_DRBD_FAULT_INJECTION
 extern unsigned int
 _drbd_insert_fault(struct drbd_conf *mdev, unsigned int type);
+
 static inline int
 drbd_insert_fault(struct drbd_conf *mdev, unsigned int type) {
+#ifdef CONFIG_DRBD_FAULT_INJECTION
        return fault_rate &&
                (enable_faults & (1<<type)) &&
                _drbd_insert_fault(mdev, type);
-}
-#define FAULT_ACTIVE(_m, _t) (drbd_insert_fault((_m), (_t)))
-
 #else
-#define FAULT_ACTIVE(_m, _t) (0)
+       return 0;
 #endif
+}
 
 /* integer division, round _UP_ to the next integer */
 #define div_ceil(A, B) ((A)/(B) + ((A)%(B) ? 1 : 0))
index 55fee1a6c647cbe1d010eeab4db962fc8ce7845d..d34d093278c7bc2f495c047e2f5c63747f844e15 100644 (file)
@@ -319,7 +319,7 @@ struct drbd_epoch_entry *drbd_alloc_ee(struct drbd_conf *mdev,
        struct page *page;
        unsigned nr_pages = (data_size + PAGE_SIZE -1) >> PAGE_SHIFT;
 
-       if (FAULT_ACTIVE(mdev, DRBD_FAULT_AL_EE))
+       if (drbd_insert_fault(mdev, DRBD_FAULT_AL_EE))
                return NULL;
 
        e = mempool_alloc(drbd_ee_mempool, gfp_mask & ~__GFP_HIGHMEM);
@@ -1264,7 +1264,7 @@ read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector, int data_size) __
                unsigned len = min_t(int, ds, PAGE_SIZE);
                data = kmap(page);
                rr = drbd_recv(mdev, data, len);
-               if (FAULT_ACTIVE(mdev, DRBD_FAULT_RECEIVE)) {
+               if (drbd_insert_fault(mdev, DRBD_FAULT_RECEIVE)) {
                        dev_err(DEV, "Fault injection: Corrupting data on receive\n");
                        data[0] = data[0] ^ (unsigned long)-1;
                }
index 079213d934905ef1e9a6ba4798400495483e05ad..53e7cc5064562127386773643670dd1dc770f58b 100644 (file)
@@ -1020,9 +1020,9 @@ allocate_barrier:
                 * stable storage, and this is a WRITE, we may not even submit
                 * this bio. */
                if (get_ldev(mdev)) {
-                       if (FAULT_ACTIVE(mdev, rw == WRITE ? DRBD_FAULT_DT_WR
-                                            : rw == READ  ? DRBD_FAULT_DT_RD
-                                            :               DRBD_FAULT_DT_RA))
+                       if (drbd_insert_fault(mdev,   rw == WRITE ? DRBD_FAULT_DT_WR
+                                                   : rw == READ  ? DRBD_FAULT_DT_RD
+                                                   :               DRBD_FAULT_DT_RA))
                                bio_endio(req->private_bio, -EIO);
                        else
                                generic_make_request(req->private_bio);
index 53586fa5ae1b098686e6171ea821fa21dc1bdb1f..151f1a37478f954360cd4fe91767922acf9ec1e7 100644 (file)
@@ -39,7 +39,7 @@ static inline void drbd_generic_make_request(struct drbd_conf *mdev,
                return;
        }
 
-       if (FAULT_ACTIVE(mdev, fault_type))
+       if (drbd_insert_fault(mdev, fault_type))
                bio_endio(bio, -EIO);
        else
                generic_make_request(bio);