diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2011-03-31 10:36:43 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:45:02 -0500 |
commit | 23361cf32b58efdf09945a64e1d8d41fa6117157 (patch) | |
tree | 4a0736ea59dfefca4f8bb3fc784d310ac18ff769 /drivers/block/drbd/drbd_int.h | |
parent | 7726547e67a1fda0d12e1de5ec917a2e5d4b8186 (diff) |
drbd: get rid of bio_split, allow bios of "arbitrary" size
Where "arbitrary" size is currently 1 MiB, which is the BIO_MAX_SIZE
for architectures with 4k PAGE_CACHE_SIZE (most).
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.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 8f43a366b82c..2dbffb3b5485 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -1326,8 +1326,16 @@ struct bm_extent { | |||
1326 | #endif | 1326 | #endif |
1327 | #endif | 1327 | #endif |
1328 | 1328 | ||
1329 | #define HT_SHIFT 8 | 1329 | /* BIO_MAX_SIZE is 256 * PAGE_CACHE_SIZE, |
1330 | #define DRBD_MAX_BIO_SIZE (1U<<(9+HT_SHIFT)) | 1330 | * so for typical PAGE_CACHE_SIZE of 4k, that is (1<<20) Byte. |
1331 | * Since we may live in a mixed-platform cluster, | ||
1332 | * we limit us to a platform agnostic constant here for now. | ||
1333 | * A followup commit may allow even bigger BIO sizes, | ||
1334 | * once we thought that through. */ | ||
1335 | #define DRBD_MAX_BIO_SIZE (1 << 20) | ||
1336 | #if DRBD_MAX_BIO_SIZE > BIO_MAX_SIZE | ||
1337 | #error Architecture not supported: DRBD_MAX_BIO_SIZE > BIO_MAX_SIZE | ||
1338 | #endif | ||
1331 | #define DRBD_MAX_BIO_SIZE_SAFE (1 << 12) /* Works always = 4k */ | 1339 | #define DRBD_MAX_BIO_SIZE_SAFE (1 << 12) /* Works always = 4k */ |
1332 | 1340 | ||
1333 | #define DRBD_MAX_SIZE_H80_PACKET (1 << 15) /* The old header only allows packets up to 32Kib data */ | 1341 | #define DRBD_MAX_SIZE_H80_PACKET (1 << 15) /* The old header only allows packets up to 32Kib data */ |
@@ -2231,20 +2239,20 @@ static inline bool may_inc_ap_bio(struct drbd_conf *mdev) | |||
2231 | return true; | 2239 | return true; |
2232 | } | 2240 | } |
2233 | 2241 | ||
2234 | static inline bool inc_ap_bio_cond(struct drbd_conf *mdev, int count) | 2242 | static inline bool inc_ap_bio_cond(struct drbd_conf *mdev) |
2235 | { | 2243 | { |
2236 | bool rv = false; | 2244 | bool rv = false; |
2237 | 2245 | ||
2238 | spin_lock_irq(&mdev->tconn->req_lock); | 2246 | spin_lock_irq(&mdev->tconn->req_lock); |
2239 | rv = may_inc_ap_bio(mdev); | 2247 | rv = may_inc_ap_bio(mdev); |
2240 | if (rv) | 2248 | if (rv) |
2241 | atomic_add(count, &mdev->ap_bio_cnt); | 2249 | atomic_inc(&mdev->ap_bio_cnt); |
2242 | spin_unlock_irq(&mdev->tconn->req_lock); | 2250 | spin_unlock_irq(&mdev->tconn->req_lock); |
2243 | 2251 | ||
2244 | return rv; | 2252 | return rv; |
2245 | } | 2253 | } |
2246 | 2254 | ||
2247 | static inline void inc_ap_bio(struct drbd_conf *mdev, int count) | 2255 | static inline void inc_ap_bio(struct drbd_conf *mdev) |
2248 | { | 2256 | { |
2249 | /* we wait here | 2257 | /* we wait here |
2250 | * as long as the device is suspended | 2258 | * as long as the device is suspended |
@@ -2254,7 +2262,7 @@ static inline void inc_ap_bio(struct drbd_conf *mdev, int count) | |||
2254 | * to avoid races with the reconnect code, | 2262 | * to avoid races with the reconnect code, |
2255 | * we need to atomic_inc within the spinlock. */ | 2263 | * we need to atomic_inc within the spinlock. */ |
2256 | 2264 | ||
2257 | wait_event(mdev->misc_wait, inc_ap_bio_cond(mdev, count)); | 2265 | wait_event(mdev->misc_wait, inc_ap_bio_cond(mdev)); |
2258 | } | 2266 | } |
2259 | 2267 | ||
2260 | static inline void dec_ap_bio(struct drbd_conf *mdev) | 2268 | static inline void dec_ap_bio(struct drbd_conf *mdev) |