diff options
Diffstat (limited to 'drivers/block/drbd/drbd_nl.c')
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index c388478a0188..55dbf83d559f 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -164,9 +164,9 @@ enum drbd_disk_state drbd_try_outdate_peer(struct drbd_conf *mdev) D_ASSERT(mdev->state.pdsk == D_UNKNOWN); - if (inc_local_if_state(mdev, D_CONSISTENT)) { + if (get_ldev_if_state(mdev, D_CONSISTENT)) { fp = mdev->bc->dc.fencing; - dec_local(mdev); + put_ldev(mdev); } else { dev_warn(DEV, "Not fencing peer, I'm not even Consistent myself.\n"); return mdev->state.pdsk; @@ -312,30 +312,30 @@ int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, int force) if (new_role == R_SECONDARY) { set_disk_ro(mdev->vdisk, TRUE); - if (inc_local(mdev)) { + if (get_ldev(mdev)) { mdev->bc->md.uuid[UI_CURRENT] &= ~(u64)1; - dec_local(mdev); + put_ldev(mdev); } } else { - if (inc_net(mdev)) { + if (get_net_conf(mdev)) { mdev->net_conf->want_lose = 0; - dec_net(mdev); + put_net_conf(mdev); } set_disk_ro(mdev->vdisk, FALSE); - if (inc_local(mdev)) { + if (get_ldev(mdev)) { if (((mdev->state.conn < C_CONNECTED || mdev->state.pdsk <= D_FAILED) && mdev->bc->md.uuid[UI_BITMAP] == 0) || forced) drbd_uuid_new_current(mdev); mdev->bc->md.uuid[UI_CURRENT] |= (u64)1; - dec_local(mdev); + put_ldev(mdev); } } - if ((new_role == R_SECONDARY) && inc_local(mdev)) { + if ((new_role == R_SECONDARY) && get_ldev(mdev)) { drbd_al_to_on_disk_bm(mdev); - dec_local(mdev); + put_ldev(mdev); } if (mdev->state.conn >= C_WF_REPORT_PARAMS) { @@ -737,7 +737,7 @@ STATIC int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp union drbd_state ns, os; int rv; int cp_discovered = 0; - int hardsect; + int hardsect_size; drbd_reconfig_start(mdev); @@ -890,7 +890,7 @@ STATIC int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp if (retcode < SS_SUCCESS) goto release_bdev2_fail; - if (!inc_local_if_state(mdev, D_ATTACHING)) + if (!get_ldev_if_state(mdev, D_ATTACHING)) goto force_diskless; drbd_md_set_sector_offsets(mdev, nbc); @@ -915,7 +915,7 @@ STATIC int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp goto force_diskless_dec; } - /* Since we are diskless, fix the AL first... */ + /* Since we are diskless, fix the activity log first... */ if (drbd_check_al_size(mdev)) { retcode = ERR_NOMEM; goto force_diskless_dec; @@ -934,19 +934,19 @@ STATIC int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp goto force_diskless_dec; } - /* allocate a second IO page if hardsect != 512 */ - hardsect = drbd_get_hardsect(nbc->md_bdev); - if (hardsect == 0) - hardsect = MD_HARDSECT; + /* allocate a second IO page if hardsect_size != 512 */ + hardsect_size = drbd_get_hardsect_size(nbc->md_bdev); + if (hardsect_size == 0) + hardsect_size = MD_SECTOR_SIZE; - if (hardsect != MD_HARDSECT) { + if (hardsect_size != MD_SECTOR_SIZE) { if (!mdev->md_io_tmpp) { struct page *page = alloc_page(GFP_NOIO); if (!page) goto force_diskless_dec; - dev_warn(DEV, "Meta data's bdev hardsect = %d != %d\n", - hardsect, MD_HARDSECT); + dev_warn(DEV, "Meta data's bdev hardsect_size = %d != %d\n", + hardsect_size, MD_SECTOR_SIZE); dev_warn(DEV, "Workaround engaged (has performace impact).\n"); mdev->md_io_tmpp = page; @@ -1089,13 +1089,13 @@ STATIC int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp drbd_md_sync(mdev); kobject_uevent(&disk_to_dev(mdev->vdisk)->kobj, KOBJ_CHANGE); - dec_local(mdev); + put_ldev(mdev); reply->ret_code = retcode; drbd_reconfig_done(mdev); return 0; force_diskless_dec: - dec_local(mdev); + put_ldev(mdev); force_diskless: drbd_force_state(mdev, NS(disk, D_DISKLESS)); drbd_md_sync(mdev); @@ -1201,7 +1201,7 @@ STATIC int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, odev = minor_to_mdev(i); if (!odev || odev == mdev) continue; - if (inc_net(odev)) { + if (get_net_conf(odev)) { taken_addr = (struct sockaddr *)&odev->net_conf->my_addr; if (new_conf->my_addr_len == odev->net_conf->my_addr_len && !memcmp(new_my_addr, taken_addr, new_conf->my_addr_len)) @@ -1212,7 +1212,7 @@ STATIC int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, !memcmp(new_peer_addr, taken_addr, new_conf->peer_addr_len)) retcode = ERR_PEER_ADDR; - dec_net(odev); + put_net_conf(odev); if (retcode != NO_ERROR) goto fail; } @@ -1451,7 +1451,7 @@ STATIC int drbd_nl_resize(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, goto fail; } - if (!inc_local(mdev)) { + if (!get_ldev(mdev)) { retcode = ERR_NO_DISK; goto fail; } @@ -1464,7 +1464,7 @@ STATIC int drbd_nl_resize(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, mdev->bc->dc.disk_size = (sector_t)rs.resize_size; dd = drbd_determin_dev_size(mdev); drbd_md_sync(mdev); - dec_local(mdev); + put_ldev(mdev); if (dd == dev_size_error) { retcode = ERR_NOMEM_BITMAP; goto fail; @@ -1610,14 +1610,14 @@ STATIC int drbd_nl_syncer_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *n } spin_unlock(&mdev->peer_seq_lock); - if (inc_local(mdev)) { + if (get_ldev(mdev)) { wait_event(mdev->al_wait, lc_try_lock(mdev->act_log)); drbd_al_shrink(mdev); err = drbd_check_al_size(mdev); lc_unlock(mdev->act_log); wake_up(&mdev->al_wait); - dec_local(mdev); + put_ldev(mdev); drbd_md_sync(mdev); if (err) { @@ -1735,14 +1735,14 @@ STATIC int drbd_nl_get_config(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nl tl = reply->tag_list; - if (inc_local(mdev)) { + if (get_ldev(mdev)) { tl = disk_conf_to_tags(mdev, &mdev->bc->dc, tl); - dec_local(mdev); + put_ldev(mdev); } - if (inc_net(mdev)) { + if (get_net_conf(mdev)) { tl = net_conf_to_tags(mdev, mdev->net_conf, tl); - dec_net(mdev); + put_net_conf(mdev); } tl = syncer_conf_to_tags(mdev, &mdev->sync_conf, tl); @@ -1763,13 +1763,13 @@ STATIC int drbd_nl_get_state(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp /* no local ref, no bitmap, no syncer progress. */ if (s.conn >= C_SYNC_SOURCE && s.conn <= C_PAUSED_SYNC_T) { - if (inc_local(mdev)) { + if (get_ldev(mdev)) { drbd_get_syncer_progress(mdev, &rs_left, &res); *tl++ = T_sync_progress; *tl++ = sizeof(int); memcpy(tl, &res, sizeof(int)); tl = (unsigned short *)((char *)tl + sizeof(int)); - dec_local(mdev); + put_ldev(mdev); } } *tl++ = TT_END; /* Close the tag list */ @@ -1784,7 +1784,7 @@ STATIC int drbd_nl_get_uuids(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp tl = reply->tag_list; - if (inc_local(mdev)) { + if (get_ldev(mdev)) { /* This is a hand crafted add tag ;) */ *tl++ = T_uuids; *tl++ = UI_SIZE*sizeof(u64); @@ -1794,7 +1794,7 @@ STATIC int drbd_nl_get_uuids(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp *tl++ = sizeof(int); memcpy(tl, &mdev->bc->md.flags, sizeof(int)); tl = (unsigned short *)((char *)tl + sizeof(int)); - dec_local(mdev); + put_ldev(mdev); } *tl++ = TT_END; /* Close the tag list */ @@ -1852,7 +1852,7 @@ STATIC int drbd_nl_new_c_uuid(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nl mutex_lock(&mdev->state_mutex); /* Protects us against serialized state changes. */ - if (!inc_local(mdev)) { + if (!get_ldev(mdev)) { retcode = ERR_NO_DISK; goto out; } @@ -1888,7 +1888,7 @@ STATIC int drbd_nl_new_c_uuid(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nl drbd_md_sync(mdev); out_dec: - dec_local(mdev); + put_ldev(mdev); out: mutex_unlock(&mdev->state_mutex); @@ -2045,7 +2045,7 @@ STATIC void drbd_connector_callback(void *data) static atomic_t drbd_nl_seq = ATOMIC_INIT(2); /* two. */ -static inline unsigned short * +static unsigned short * __tl_add_blob(unsigned short *tl, enum drbd_tags tag, const void *data, int len, int nul_terminated) { @@ -2065,19 +2065,19 @@ __tl_add_blob(unsigned short *tl, enum drbd_tags tag, const void *data, return tl; } -static inline unsigned short * +static unsigned short * tl_add_blob(unsigned short *tl, enum drbd_tags tag, const void *data, int len) { return __tl_add_blob(tl, tag, data, len, 0); } -static inline unsigned short * +static unsigned short * tl_add_str(unsigned short *tl, enum drbd_tags tag, const char *str) { return __tl_add_blob(tl, tag, str, strlen(str)+1, 0); } -static inline unsigned short * +static unsigned short * tl_add_int(unsigned short *tl, enum drbd_tags tag, const void *val) { switch(tag_type(tag)) { @@ -2255,10 +2255,10 @@ void drbd_bcast_sync_progress(struct drbd_conf *mdev) unsigned int res; /* no local ref, no bitmap, no syncer progress, no broadcast. */ - if (!inc_local(mdev)) + if (!get_ldev(mdev)) return; drbd_get_syncer_progress(mdev, &rs_left, &res); - dec_local(mdev); + put_ldev(mdev); *tl++ = T_sync_progress; *tl++ = sizeof(int); |