oinfo_ptrs_size = sizeof(struct lov_oinfo *) * stripe_count;
*size = sizeof(struct lov_stripe_md) + oinfo_ptrs_size;
- OBD_ALLOC_LARGE(lsm, *size);
+ lsm = libcfs_kvzalloc(*size, GFP_NOFS);
if (!lsm)
return NULL;
err:
while (--i >= 0)
OBD_SLAB_FREE(lsm->lsm_oinfo[i], lov_oinfo_slab, sizeof(*loi));
- OBD_FREE_LARGE(lsm, *size);
+ kvfree(lsm);
return NULL;
}
for (i = 0; i < stripe_count; i++)
OBD_SLAB_FREE(lsm->lsm_oinfo[i], lov_oinfo_slab,
sizeof(struct lov_oinfo));
- OBD_FREE_LARGE(lsm, sizeof(struct lov_stripe_md) +
- stripe_count * sizeof(struct lov_oinfo *));
+ kvfree(lsm);
}
static void lsm_unpackmd_common(struct lov_stripe_md *lsm,
* Need to be optimized, we can't afford to allocate a piece of memory
* when writing a page. -jay
*/
- OBD_ALLOC_LARGE(lio->lis_subs,
- lsm->lsm_stripe_count * sizeof(lio->lis_subs[0]));
+ lio->lis_subs =
+ libcfs_kvzalloc(lsm->lsm_stripe_count *
+ sizeof(lio->lis_subs[0]),
+ GFP_NOFS);
if (lio->lis_subs != NULL) {
lio->lis_nr_subios = lio->lis_stripe_count;
lio->lis_single_subio_index = -1;
if (lio->lis_subs != NULL) {
for (i = 0; i < lio->lis_nr_subios; i++)
lov_io_sub_fini(env, lio, &lio->lis_subs[i]);
- OBD_FREE_LARGE(lio->lis_subs,
- lio->lis_nr_subios * sizeof(lio->lis_subs[0]));
+ kvfree(lio->lis_subs);
lio->lis_nr_subios = 0;
}
LASSERT(lio->lis_subs != NULL);
if (alloc) {
- OBD_ALLOC_LARGE(stripes_qin,
- sizeof(*stripes_qin) * lio->lis_nr_subios);
+ stripes_qin =
+ libcfs_kvzalloc(sizeof(*stripes_qin) *
+ lio->lis_nr_subios,
+ GFP_NOFS);
if (stripes_qin == NULL)
return -ENOMEM;
}
if (alloc) {
- OBD_FREE_LARGE(stripes_qin,
- sizeof(*stripes_qin) * lio->lis_nr_subios);
+ kvfree(stripes_qin);
} else {
int i;
nr++;
}
LASSERT(nr > 0);
- OBD_ALLOC_LARGE(lck->lls_sub, nr * sizeof(lck->lls_sub[0]));
+ lck->lls_sub = libcfs_kvzalloc(nr * sizeof(lck->lls_sub[0]), GFP_NOFS);
if (lck->lls_sub == NULL)
return -ENOMEM;
* a reference on its parent.
*/
LASSERT(lck->lls_sub[i].sub_lock == NULL);
- OBD_FREE_LARGE(lck->lls_sub,
- lck->lls_nr * sizeof(lck->lls_sub[0]));
+ kvfree(lck->lls_sub);
}
OBD_SLAB_FREE_PTR(lck, lov_lock_kmem);
}
if (fiemap_count_to_size(fm_key->fiemap.fm_extent_count) < buffer_size)
buffer_size = fiemap_count_to_size(fm_key->fiemap.fm_extent_count);
- OBD_ALLOC_LARGE(fm_local, buffer_size);
+ fm_local = libcfs_kvzalloc(buffer_size, GFP_NOFS);
if (fm_local == NULL) {
rc = -ENOMEM;
goto out;
fiemap->fm_mapped_extents = current_extent;
out:
- OBD_FREE_LARGE(fm_local, buffer_size);
+ kvfree(fm_local);
return rc;
}
r0->lo_nr = lsm->lsm_stripe_count;
LASSERT(r0->lo_nr <= lov_targets_nr(dev));
- OBD_ALLOC_LARGE(r0->lo_sub, r0->lo_nr * sizeof(r0->lo_sub[0]));
+ r0->lo_sub = libcfs_kvzalloc(r0->lo_nr * sizeof(r0->lo_sub[0]),
+ GFP_NOFS);
if (r0->lo_sub != NULL) {
result = 0;
subconf->coc_inode = conf->coc_inode;
struct lov_layout_raid0 *r0 = &state->raid0;
if (r0->lo_sub != NULL) {
- OBD_FREE_LARGE(r0->lo_sub, r0->lo_nr * sizeof(r0->lo_sub[0]));
+ kvfree(r0->lo_sub);
r0->lo_sub = NULL;
}
if (*lmmp && !lsm) {
stripe_count = le16_to_cpu((*lmmp)->lmm_stripe_count);
lmm_size = lov_mds_md_size(stripe_count, lmm_magic);
- OBD_FREE_LARGE(*lmmp, lmm_size);
+ kvfree(*lmmp);
*lmmp = NULL;
return 0;
}
if (!*lmmp) {
- OBD_ALLOC_LARGE(*lmmp, lmm_size);
+ *lmmp = libcfs_kvzalloc(lmm_size, GFP_NOFS);
if (!*lmmp)
return -ENOMEM;
}
CERROR("bad disk LOV MAGIC: 0x%08X; dumping LMM (size=%d):\n",
le32_to_cpu(*(__u32 *)lmm), lmm_bytes);
sz = lmm_bytes * 2 + 1;
- OBD_ALLOC_LARGE(buffer, sz);
+ buffer = libcfs_kvzalloc(sz, GFP_NOFS);
if (buffer != NULL) {
int i;
sprintf(buffer+2*i, "%.2X", ((char *)lmm)[i]);
buffer[sz - 1] = '\0';
CERROR("%s\n", buffer);
- OBD_FREE_LARGE(buffer, sz);
+ kvfree(buffer);
}
return -EINVAL;
}