2009-09-26 07:07:19 +08:00
|
|
|
#ifndef _DRBD_WRAPPERS_H
|
|
|
|
#define _DRBD_WRAPPERS_H
|
|
|
|
|
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <linux/mm.h>
|
2011-06-10 18:57:26 +08:00
|
|
|
#include "drbd_int.h"
|
2009-09-26 07:07:19 +08:00
|
|
|
|
|
|
|
/* see get_sb_bdev and bd_claim */
|
|
|
|
extern char *drbd_sec_holder;
|
|
|
|
|
|
|
|
/* sets the number of 512 byte sectors of our virtual device */
|
2011-07-03 19:26:43 +08:00
|
|
|
static inline void drbd_set_my_capacity(struct drbd_device *device,
|
2009-09-26 07:07:19 +08:00
|
|
|
sector_t size)
|
|
|
|
{
|
2011-07-03 19:26:43 +08:00
|
|
|
/* set_capacity(device->this_bdev->bd_disk, size); */
|
|
|
|
set_capacity(device->vdisk, size);
|
|
|
|
device->this_bdev->bd_inode->i_size = (loff_t)size << 9;
|
2009-09-26 07:07:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#define drbd_bio_uptodate(bio) bio_flagged(bio, BIO_UPTODATE)
|
|
|
|
|
|
|
|
/* bi_end_io handlers */
|
|
|
|
extern void drbd_md_io_complete(struct bio *bio, int error);
|
2011-02-17 23:46:59 +08:00
|
|
|
extern void drbd_peer_request_endio(struct bio *bio, int error);
|
|
|
|
extern void drbd_request_endio(struct bio *bio, int error);
|
2009-09-26 07:07:19 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* used to submit our private bio
|
|
|
|
*/
|
2011-07-03 19:26:43 +08:00
|
|
|
static inline void drbd_generic_make_request(struct drbd_device *device,
|
2009-09-26 07:07:19 +08:00
|
|
|
int fault_type, struct bio *bio)
|
|
|
|
{
|
|
|
|
__release(local);
|
|
|
|
if (!bio->bi_bdev) {
|
|
|
|
printk(KERN_ERR "drbd%d: drbd_generic_make_request: "
|
|
|
|
"bio->bi_bdev == NULL\n",
|
2011-07-03 19:26:43 +08:00
|
|
|
device_to_minor(device));
|
2009-09-26 07:07:19 +08:00
|
|
|
dump_stack();
|
|
|
|
bio_endio(bio, -ENODEV);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-07-03 19:26:43 +08:00
|
|
|
if (drbd_insert_fault(device, fault_type))
|
2009-09-26 07:07:19 +08:00
|
|
|
bio_endio(bio, -EIO);
|
|
|
|
else
|
|
|
|
generic_make_request(bio);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef __CHECKER__
|
|
|
|
# undef __cond_lock
|
|
|
|
# define __cond_lock(x,c) (c)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|