1 #ifndef _DRBD_WRAPPERS_H
2 #define _DRBD_WRAPPERS_H
3
4 #include <linux/ctype.h>
5 #include <linux/mm.h>
6 #include "drbd_int.h"
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 */
drbd_set_my_capacity(struct drbd_conf * mdev,sector_t size)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
22 /* bi_end_io handlers */
23 extern void drbd_md_io_complete(struct bio *bio, int error);
24 extern void drbd_peer_request_endio(struct bio *bio, int error);
25 extern void drbd_request_endio(struct bio *bio, int error);
26
27 /*
28 * used to submit our private bio
29 */
drbd_generic_make_request(struct drbd_conf * mdev,int fault_type,struct bio * bio)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
43 if (drbd_insert_fault(mdev, fault_type))
44 bio_endio(bio, -EIO);
45 else
46 generic_make_request(bio);
47 }
48
49 #ifndef __CHECKER__
50 # undef __cond_lock
51 # define __cond_lock(x,c) (c)
52 #endif
53
54 #endif
55