aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_int.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/drbd/drbd_int.h')
-rw-r--r--drivers/block/drbd/drbd_int.h44
1 files changed, 31 insertions, 13 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 02f013a073a7..b2ca143d0053 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -813,7 +813,6 @@ enum {
813 SIGNAL_ASENDER, /* whether asender wants to be interrupted */ 813 SIGNAL_ASENDER, /* whether asender wants to be interrupted */
814 SEND_PING, /* whether asender should send a ping asap */ 814 SEND_PING, /* whether asender should send a ping asap */
815 815
816 UNPLUG_QUEUED, /* only relevant with kernel 2.4 */
817 UNPLUG_REMOTE, /* sending a "UnplugRemote" could help */ 816 UNPLUG_REMOTE, /* sending a "UnplugRemote" could help */
818 MD_DIRTY, /* current uuids and flags not yet on disk */ 817 MD_DIRTY, /* current uuids and flags not yet on disk */
819 DISCARD_CONCURRENT, /* Set on one node, cleared on the peer! */ 818 DISCARD_CONCURRENT, /* Set on one node, cleared on the peer! */
@@ -824,7 +823,6 @@ enum {
824 CRASHED_PRIMARY, /* This node was a crashed primary. 823 CRASHED_PRIMARY, /* This node was a crashed primary.
825 * Gets cleared when the state.conn 824 * Gets cleared when the state.conn
826 * goes into C_CONNECTED state. */ 825 * goes into C_CONNECTED state. */
827 NO_BARRIER_SUPP, /* underlying block device doesn't implement barriers */
828 CONSIDER_RESYNC, 826 CONSIDER_RESYNC,
829 827
830 MD_NO_FUA, /* Users wants us to not use FUA/FLUSH on meta data dev */ 828 MD_NO_FUA, /* Users wants us to not use FUA/FLUSH on meta data dev */
@@ -834,6 +832,7 @@ enum {
834 BITMAP_IO_QUEUED, /* Started bitmap IO */ 832 BITMAP_IO_QUEUED, /* Started bitmap IO */
835 GO_DISKLESS, /* Disk is being detached, on io-error or admin request. */ 833 GO_DISKLESS, /* Disk is being detached, on io-error or admin request. */
836 WAS_IO_ERROR, /* Local disk failed returned IO error */ 834 WAS_IO_ERROR, /* Local disk failed returned IO error */
835 FORCE_DETACH, /* Force-detach from local disk, aborting any pending local IO */
837 RESYNC_AFTER_NEG, /* Resync after online grow after the attach&negotiate finished. */ 836 RESYNC_AFTER_NEG, /* Resync after online grow after the attach&negotiate finished. */
838 NET_CONGESTED, /* The data socket is congested */ 837 NET_CONGESTED, /* The data socket is congested */
839 838
@@ -851,6 +850,13 @@ enum {
851 AL_SUSPENDED, /* Activity logging is currently suspended. */ 850 AL_SUSPENDED, /* Activity logging is currently suspended. */
852 AHEAD_TO_SYNC_SOURCE, /* Ahead -> SyncSource queued */ 851 AHEAD_TO_SYNC_SOURCE, /* Ahead -> SyncSource queued */
853 STATE_SENT, /* Do not change state/UUIDs while this is set */ 852 STATE_SENT, /* Do not change state/UUIDs while this is set */
853
854 CALLBACK_PENDING, /* Whether we have a call_usermodehelper(, UMH_WAIT_PROC)
855 * pending, from drbd worker context.
856 * If set, bdi_write_congested() returns true,
857 * so shrink_page_list() would not recurse into,
858 * and potentially deadlock on, this drbd worker.
859 */
854}; 860};
855 861
856struct drbd_bitmap; /* opaque for drbd_conf */ 862struct drbd_bitmap; /* opaque for drbd_conf */
@@ -1130,8 +1136,8 @@ struct drbd_conf {
1130 int rs_in_flight; /* resync sectors in flight (to proxy, in proxy and from proxy) */ 1136 int rs_in_flight; /* resync sectors in flight (to proxy, in proxy and from proxy) */
1131 int rs_planed; /* resync sectors already planned */ 1137 int rs_planed; /* resync sectors already planned */
1132 atomic_t ap_in_flight; /* App sectors in flight (waiting for ack) */ 1138 atomic_t ap_in_flight; /* App sectors in flight (waiting for ack) */
1133 int peer_max_bio_size; 1139 unsigned int peer_max_bio_size;
1134 int local_max_bio_size; 1140 unsigned int local_max_bio_size;
1135}; 1141};
1136 1142
1137static inline struct drbd_conf *minor_to_mdev(unsigned int minor) 1143static inline struct drbd_conf *minor_to_mdev(unsigned int minor)
@@ -1435,9 +1441,9 @@ struct bm_extent {
1435 * hash table. */ 1441 * hash table. */
1436#define HT_SHIFT 8 1442#define HT_SHIFT 8
1437#define DRBD_MAX_BIO_SIZE (1U<<(9+HT_SHIFT)) 1443#define DRBD_MAX_BIO_SIZE (1U<<(9+HT_SHIFT))
1438#define DRBD_MAX_BIO_SIZE_SAFE (1 << 12) /* Works always = 4k */ 1444#define DRBD_MAX_BIO_SIZE_SAFE (1U << 12) /* Works always = 4k */
1439 1445
1440#define DRBD_MAX_SIZE_H80_PACKET (1 << 15) /* The old header only allows packets up to 32Kib data */ 1446#define DRBD_MAX_SIZE_H80_PACKET (1U << 15) /* The old header only allows packets up to 32Kib data */
1441 1447
1442/* Number of elements in the app_reads_hash */ 1448/* Number of elements in the app_reads_hash */
1443#define APP_R_HSIZE 15 1449#define APP_R_HSIZE 15
@@ -1840,12 +1846,20 @@ static inline int drbd_request_state(struct drbd_conf *mdev,
1840 return _drbd_request_state(mdev, mask, val, CS_VERBOSE + CS_ORDERED); 1846 return _drbd_request_state(mdev, mask, val, CS_VERBOSE + CS_ORDERED);
1841} 1847}
1842 1848
1849enum drbd_force_detach_flags {
1850 DRBD_IO_ERROR,
1851 DRBD_META_IO_ERROR,
1852 DRBD_FORCE_DETACH,
1853};
1854
1843#define __drbd_chk_io_error(m,f) __drbd_chk_io_error_(m,f, __func__) 1855#define __drbd_chk_io_error(m,f) __drbd_chk_io_error_(m,f, __func__)
1844static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, int forcedetach, const char *where) 1856static inline void __drbd_chk_io_error_(struct drbd_conf *mdev,
1857 enum drbd_force_detach_flags forcedetach,
1858 const char *where)
1845{ 1859{
1846 switch (mdev->ldev->dc.on_io_error) { 1860 switch (mdev->ldev->dc.on_io_error) {
1847 case EP_PASS_ON: 1861 case EP_PASS_ON:
1848 if (!forcedetach) { 1862 if (forcedetach == DRBD_IO_ERROR) {
1849 if (__ratelimit(&drbd_ratelimit_state)) 1863 if (__ratelimit(&drbd_ratelimit_state))
1850 dev_err(DEV, "Local IO failed in %s.\n", where); 1864 dev_err(DEV, "Local IO failed in %s.\n", where);
1851 if (mdev->state.disk > D_INCONSISTENT) 1865 if (mdev->state.disk > D_INCONSISTENT)
@@ -1856,6 +1870,8 @@ static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, int forcedetach,
1856 case EP_DETACH: 1870 case EP_DETACH:
1857 case EP_CALL_HELPER: 1871 case EP_CALL_HELPER:
1858 set_bit(WAS_IO_ERROR, &mdev->flags); 1872 set_bit(WAS_IO_ERROR, &mdev->flags);
1873 if (forcedetach == DRBD_FORCE_DETACH)
1874 set_bit(FORCE_DETACH, &mdev->flags);
1859 if (mdev->state.disk > D_FAILED) { 1875 if (mdev->state.disk > D_FAILED) {
1860 _drbd_set_state(_NS(mdev, disk, D_FAILED), CS_HARD, NULL); 1876 _drbd_set_state(_NS(mdev, disk, D_FAILED), CS_HARD, NULL);
1861 dev_err(DEV, 1877 dev_err(DEV,
@@ -1875,7 +1891,7 @@ static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, int forcedetach,
1875 */ 1891 */
1876#define drbd_chk_io_error(m,e,f) drbd_chk_io_error_(m,e,f, __func__) 1892#define drbd_chk_io_error(m,e,f) drbd_chk_io_error_(m,e,f, __func__)
1877static inline void drbd_chk_io_error_(struct drbd_conf *mdev, 1893static inline void drbd_chk_io_error_(struct drbd_conf *mdev,
1878 int error, int forcedetach, const char *where) 1894 int error, enum drbd_force_detach_flags forcedetach, const char *where)
1879{ 1895{
1880 if (error) { 1896 if (error) {
1881 unsigned long flags; 1897 unsigned long flags;
@@ -2405,15 +2421,17 @@ static inline void dec_ap_bio(struct drbd_conf *mdev)
2405 int ap_bio = atomic_dec_return(&mdev->ap_bio_cnt); 2421 int ap_bio = atomic_dec_return(&mdev->ap_bio_cnt);
2406 2422
2407 D_ASSERT(ap_bio >= 0); 2423 D_ASSERT(ap_bio >= 0);
2424
2425 if (ap_bio == 0 && test_bit(BITMAP_IO, &mdev->flags)) {
2426 if (!test_and_set_bit(BITMAP_IO_QUEUED, &mdev->flags))
2427 drbd_queue_work(&mdev->data.work, &mdev->bm_io_work.w);
2428 }
2429
2408 /* this currently does wake_up for every dec_ap_bio! 2430 /* this currently does wake_up for every dec_ap_bio!
2409 * maybe rather introduce some type of hysteresis? 2431 * maybe rather introduce some type of hysteresis?
2410 * e.g. (ap_bio == mxb/2 || ap_bio == 0) ? */ 2432 * e.g. (ap_bio == mxb/2 || ap_bio == 0) ? */
2411 if (ap_bio < mxb) 2433 if (ap_bio < mxb)
2412 wake_up(&mdev->misc_wait); 2434 wake_up(&mdev->misc_wait);
2413 if (ap_bio == 0 && test_bit(BITMAP_IO, &mdev->flags)) {
2414 if (!test_and_set_bit(BITMAP_IO_QUEUED, &mdev->flags))
2415 drbd_queue_work(&mdev->data.work, &mdev->bm_io_work.w);
2416 }
2417} 2435}
2418 2436
2419static inline int drbd_set_ed_uuid(struct drbd_conf *mdev, u64 val) 2437static inline int drbd_set_ed_uuid(struct drbd_conf *mdev, u64 val)