Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 1 | #ifndef _DRBD_WRAPPERS_H |
| 2 | #define _DRBD_WRAPPERS_H |
| 3 | |
| 4 | #include <linux/ctype.h> |
| 5 | #include <linux/mm.h> |
Andreas Gruenbacher | 01b39b5 | 2011-06-10 12:57:26 +0200 | [diff] [blame] | 6 | #include "drbd_int.h" |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 7 | |
| 8 | /* see get_sb_bdev and bd_claim */ |
| 9 | extern char *drbd_sec_holder; |
| 10 | |
| 11 | /* sets the number of 512 byte sectors of our virtual device */ |
| 12 | static inline void drbd_set_my_capacity(struct drbd_conf *mdev, |
| 13 | sector_t size) |
| 14 | { |
| 15 | /* set_capacity(mdev->this_bdev->bd_disk, size); */ |
| 16 | set_capacity(mdev->vdisk, size); |
| 17 | mdev->this_bdev->bd_inode->i_size = (loff_t)size << 9; |
| 18 | } |
| 19 | |
| 20 | #define drbd_bio_uptodate(bio) bio_flagged(bio, BIO_UPTODATE) |
| 21 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 22 | /* bi_end_io handlers */ |
| 23 | extern void drbd_md_io_complete(struct bio *bio, int error); |
Andreas Gruenbacher | fcefa62 | 2011-02-17 16:46:59 +0100 | [diff] [blame] | 24 | extern void drbd_peer_request_endio(struct bio *bio, int error); |
| 25 | extern void drbd_request_endio(struct bio *bio, int error); |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 26 | |
| 27 | /* |
| 28 | * used to submit our private bio |
| 29 | */ |
| 30 | static inline void drbd_generic_make_request(struct drbd_conf *mdev, |
| 31 | int fault_type, struct bio *bio) |
| 32 | { |
| 33 | __release(local); |
| 34 | if (!bio->bi_bdev) { |
| 35 | printk(KERN_ERR "drbd%d: drbd_generic_make_request: " |
| 36 | "bio->bi_bdev == NULL\n", |
| 37 | mdev_to_minor(mdev)); |
| 38 | dump_stack(); |
| 39 | bio_endio(bio, -ENODEV); |
| 40 | return; |
| 41 | } |
| 42 | |
Andreas Gruenbacher | 0cf9d27 | 2010-12-07 10:43:29 +0100 | [diff] [blame] | 43 | if (drbd_insert_fault(mdev, fault_type)) |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 44 | bio_endio(bio, -EIO); |
| 45 | else |
| 46 | generic_make_request(bio); |
| 47 | } |
| 48 | |
Philipp Reisner | b411b36 | 2009-09-25 16:07:19 -0700 | [diff] [blame] | 49 | #ifndef __CHECKER__ |
| 50 | # undef __cond_lock |
| 51 | # define __cond_lock(x,c) (c) |
| 52 | #endif |
| 53 | |
| 54 | #endif |