aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_int.h
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2011-01-21 04:56:44 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:48:02 -0500
commit20ceb2b22edaf51e59e76087efdc71a16a2858de (patch)
treea4f267242725bac2a915e879a6b6ac259218c5fa /drivers/block/drbd/drbd_int.h
parent62b0da3a244ac33d25a77861ef1cc0080103f2ff (diff)
drbd: describe bitmap locking for bulk operation in finer detail
Now that we do no longer in-place endian-swap the bitmap, we allow selected bitmap operations (testing bits, sometimes even settting bits) during some bulk operations. This caused us to hit a lot of FIXME asserts similar to FIXME asender in drbd_bm_count_bits, bitmap locked for 'write from resync_finished' by worker Which now is nonsense: looking at the bitmap is perfectly legal as long as it is not being resized. This cosmetic patch defines some flags to describe expectations in finer detail, so the asserts in e.g. bm_change_bits_to() can be skipped if appropriate. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_int.h')
-rw-r--r--drivers/block/drbd/drbd_int.h36
1 files changed, 32 insertions, 4 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 0a9059eb94db..267d9897ca8c 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -855,6 +855,32 @@ enum {
855 855
856struct drbd_bitmap; /* opaque for drbd_conf */ 856struct drbd_bitmap; /* opaque for drbd_conf */
857 857
858/* definition of bits in bm_flags to be used in drbd_bm_lock
859 * and drbd_bitmap_io and friends. */
860enum bm_flag {
861 /* do we need to kfree, or vfree bm_pages? */
862 BM_P_VMALLOCED = 0x10000, /* internal use only, will be masked out */
863
864 /* currently locked for bulk operation */
865 BM_LOCKED_MASK = 0x7,
866
867 /* in detail, that is: */
868 BM_DONT_CLEAR = 0x1,
869 BM_DONT_SET = 0x2,
870 BM_DONT_TEST = 0x4,
871
872 /* (test bit, count bit) allowed (common case) */
873 BM_LOCKED_TEST_ALLOWED = 0x3,
874
875 /* testing bits, as well as setting new bits allowed, but clearing bits
876 * would be unexpected. Used during bitmap receive. Setting new bits
877 * requires sending of "out-of-sync" information, though. */
878 BM_LOCKED_SET_ALLOWED = 0x1,
879
880 /* clear is not expected while bitmap is locked for bulk operation */
881};
882
883
858/* TODO sort members for performance 884/* TODO sort members for performance
859 * MAYBE group them further */ 885 * MAYBE group them further */
860 886
@@ -920,6 +946,7 @@ struct drbd_md_io {
920struct bm_io_work { 946struct bm_io_work {
921 struct drbd_work w; 947 struct drbd_work w;
922 char *why; 948 char *why;
949 enum bm_flag flags;
923 int (*io_fn)(struct drbd_conf *mdev); 950 int (*io_fn)(struct drbd_conf *mdev);
924 void (*done)(struct drbd_conf *mdev, int rv); 951 void (*done)(struct drbd_conf *mdev, int rv);
925}; 952};
@@ -1242,7 +1269,6 @@ extern void drbd_free_bc(struct drbd_backing_dev *ldev);
1242extern void drbd_mdev_cleanup(struct drbd_conf *mdev); 1269extern void drbd_mdev_cleanup(struct drbd_conf *mdev);
1243void drbd_print_uuids(struct drbd_conf *mdev, const char *text); 1270void drbd_print_uuids(struct drbd_conf *mdev, const char *text);
1244 1271
1245/* drbd_meta-data.c (still in drbd_main.c) */
1246extern void drbd_md_sync(struct drbd_conf *mdev); 1272extern void drbd_md_sync(struct drbd_conf *mdev);
1247extern int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev); 1273extern int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev);
1248extern void drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val) __must_hold(local); 1274extern void drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val) __must_hold(local);
@@ -1263,10 +1289,12 @@ extern void drbd_md_mark_dirty_(struct drbd_conf *mdev,
1263extern void drbd_queue_bitmap_io(struct drbd_conf *mdev, 1289extern void drbd_queue_bitmap_io(struct drbd_conf *mdev,
1264 int (*io_fn)(struct drbd_conf *), 1290 int (*io_fn)(struct drbd_conf *),
1265 void (*done)(struct drbd_conf *, int), 1291 void (*done)(struct drbd_conf *, int),
1266 char *why); 1292 char *why, enum bm_flag flags);
1293extern int drbd_bitmap_io(struct drbd_conf *mdev,
1294 int (*io_fn)(struct drbd_conf *),
1295 char *why, enum bm_flag flags);
1267extern int drbd_bmio_set_n_write(struct drbd_conf *mdev); 1296extern int drbd_bmio_set_n_write(struct drbd_conf *mdev);
1268extern int drbd_bmio_clear_n_write(struct drbd_conf *mdev); 1297extern int drbd_bmio_clear_n_write(struct drbd_conf *mdev);
1269extern int drbd_bitmap_io(struct drbd_conf *mdev, int (*io_fn)(struct drbd_conf *), char *why);
1270extern void drbd_go_diskless(struct drbd_conf *mdev); 1298extern void drbd_go_diskless(struct drbd_conf *mdev);
1271extern void drbd_ldev_destroy(struct drbd_conf *mdev); 1299extern void drbd_ldev_destroy(struct drbd_conf *mdev);
1272 1300
@@ -1452,7 +1480,7 @@ extern void drbd_bm_merge_lel(struct drbd_conf *mdev, size_t offset,
1452extern void drbd_bm_get_lel(struct drbd_conf *mdev, size_t offset, 1480extern void drbd_bm_get_lel(struct drbd_conf *mdev, size_t offset,
1453 size_t number, unsigned long *buffer); 1481 size_t number, unsigned long *buffer);
1454 1482
1455extern void drbd_bm_lock(struct drbd_conf *mdev, char *why); 1483extern void drbd_bm_lock(struct drbd_conf *mdev, char *why, enum bm_flag flags);
1456extern void drbd_bm_unlock(struct drbd_conf *mdev); 1484extern void drbd_bm_unlock(struct drbd_conf *mdev);
1457/* drbd_main.c */ 1485/* drbd_main.c */
1458 1486