blob: 328f18e4b4eedb3cc0faf85fdbca183cae5f52e0 [file] [log] [blame]
Philipp Reisnerb411b362009-09-25 16:07:19 -07001#ifndef _DRBD_WRAPPERS_H
2#define _DRBD_WRAPPERS_H
3
4#include <linux/ctype.h>
5#include <linux/mm.h>
Andreas Gruenbacher01b39b52011-06-10 12:57:26 +02006#include "drbd_int.h"
Philipp Reisnerb411b362009-09-25 16:07:19 -07007
8/* see get_sb_bdev and bd_claim */
9extern char *drbd_sec_holder;
10
11/* sets the number of 512 byte sectors of our virtual device */
12static 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 Reisnerb411b362009-09-25 16:07:19 -070022/* bi_end_io handlers */
23extern void drbd_md_io_complete(struct bio *bio, int error);
Andreas Gruenbacherfcefa622011-02-17 16:46:59 +010024extern void drbd_peer_request_endio(struct bio *bio, int error);
25extern void drbd_request_endio(struct bio *bio, int error);
Philipp Reisnerb411b362009-09-25 16:07:19 -070026
27/*
28 * used to submit our private bio
29 */
30static 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 Gruenbacher0cf9d272010-12-07 10:43:29 +010043 if (drbd_insert_fault(mdev, fault_type))
Philipp Reisnerb411b362009-09-25 16:07:19 -070044 bio_endio(bio, -EIO);
45 else
46 generic_make_request(bio);
47}
48
Philipp Reisnerb411b362009-09-25 16:07:19 -070049#ifndef __CHECKER__
50# undef __cond_lock
51# define __cond_lock(x,c) (c)
52#endif
53
54#endif