#include <lprocfs_status.h>
#include <lustre_param.h>
#include <cl_object.h>
-#include <lclient.h> /* for cl_client_lru */
+#include <lclient.h>
#include <lustre/ll_fiemap.h>
#include <lustre_log.h>
#include <lustre_fid.h>
RETURN(-EINVAL);
/* copy UUID */
- if (cfs_copy_to_user(data->ioc_pbuf2, obd2cli_tgt(osc_obd),
- min((int) data->ioc_plen2,
- (int) sizeof(struct obd_uuid))))
+ if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(osc_obd),
+ min((int)data->ioc_plen2,
+ (int)sizeof(struct obd_uuid))))
RETURN(-EFAULT);
flags = uarg ? *(__u32*)uarg : 0;
flags);
if (rc)
RETURN(rc);
- if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
+ if (copy_to_user(data->ioc_pbuf1, &stat_buf,
min((int) data->ioc_plen1,
(int) sizeof(stat_buf))))
RETURN(-EFAULT);
*genp = lov->lov_tgts[i]->ltd_gen;
}
- if (cfs_copy_to_user((void *)uarg, buf, len))
+ if (copy_to_user((void *)uarg, buf, len))
rc = -EFAULT;
obd_ioctl_freedata(buf, len);
break;
struct lov_tgt_desc *tgt = NULL;
struct obd_quotactl *oqctl;
- if (qctl->qc_valid == QC_OSTIDX) {
- if (qctl->qc_idx < 0 || count <= qctl->qc_idx)
- RETURN(-EINVAL);
+ if (qctl->qc_valid == QC_OSTIDX) {
+ if (count <= qctl->qc_idx)
+ RETURN(-EINVAL);
- tgt = lov->lov_tgts[qctl->qc_idx];
- if (!tgt || !tgt->ltd_exp)
- RETURN(-EINVAL);
+ tgt = lov->lov_tgts[qctl->qc_idx];
+ if (!tgt || !tgt->ltd_exp)
+ RETURN(-EINVAL);
} else if (qctl->qc_valid == QC_UUID) {
for (i = 0; i < count; i++) {
tgt = lov->lov_tgts[i];
int cur_stripe = 0, cur_stripe_wrap = 0, stripe_count;
unsigned int buffer_size = FIEMAP_BUFFER_SIZE;
- if (!lsm_has_objects(lsm))
- GOTO(out, rc = 0);
+ if (!lsm_has_objects(lsm)) {
+ if (lsm && lsm_is_released(lsm) && (fm_key->fiemap.fm_start <
+ fm_key->oa.o_size)) {
+ /* released file, return a minimal FIEMAP if
+ * request fits in file-size.
+ */
+ fiemap->fm_mapped_extents = 1;
+ fiemap->fm_extents[0].fe_logical =
+ fm_key->fiemap.fm_start;
+ if (fm_key->fiemap.fm_start + fm_key->fiemap.fm_length <
+ fm_key->oa.o_size)
+ fiemap->fm_extents[0].fe_length =
+ fm_key->fiemap.fm_length;
+ else
+ fiemap->fm_extents[0].fe_length =
+ fm_key->oa.o_size -
+ fm_key->fiemap.fm_start;
+ fiemap->fm_extents[0].fe_flags |=
+ (FIEMAP_EXTENT_UNKNOWN |
+ FIEMAP_EXTENT_LAST);
+ }
+ GOTO(out, rc = 0);
+ }
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);
fiemap->fm_mapped_extents = current_extent;
out:
- OBD_FREE_LARGE(fm_local, buffer_size);
+ if (fm_local)
+ OBD_FREE_LARGE(fm_local, buffer_size);
return rc;
}
void lov_stripe_lock(struct lov_stripe_md *md)
{
- LASSERT(md->lsm_lock_owner != cfs_curproc_pid());
+ LASSERT(md->lsm_lock_owner != current_pid());
spin_lock(&md->lsm_lock);
LASSERT(md->lsm_lock_owner == 0);
- md->lsm_lock_owner = cfs_curproc_pid();
+ md->lsm_lock_owner = current_pid();
}
EXPORT_SYMBOL(lov_stripe_lock);
void lov_stripe_unlock(struct lov_stripe_md *md)
{
- LASSERT(md->lsm_lock_owner == cfs_curproc_pid());
+ LASSERT(md->lsm_lock_owner == current_pid());
md->lsm_lock_owner = 0;
spin_unlock(&md->lsm_lock);
}
.o_quotacheck = lov_quotacheck,
};
-cfs_mem_cache_t *lov_oinfo_slab;
+struct kmem_cache *lov_oinfo_slab;
extern struct lu_kmem_descr lov_caches[];
int __init lov_init(void)
{
struct lprocfs_static_vars lvars = { 0 };
- int rc, rc2;
+ int rc;
ENTRY;
/* print an address of _any_ initialized kernel symbol from this
if (rc)
return rc;
- lov_oinfo_slab = cfs_mem_cache_create("lov_oinfo",
- sizeof(struct lov_oinfo),
- 0, CFS_SLAB_HWCACHE_ALIGN);
+ lov_oinfo_slab = kmem_cache_create("lov_oinfo",
+ sizeof(struct lov_oinfo), 0,
+ SLAB_HWCACHE_ALIGN, NULL);
if (lov_oinfo_slab == NULL) {
lu_kmem_fini(lov_caches);
return -ENOMEM;
LUSTRE_LOV_NAME, &lov_device_type);
if (rc) {
- rc2 = cfs_mem_cache_destroy(lov_oinfo_slab);
- LASSERT(rc2 == 0);
+ kmem_cache_destroy(lov_oinfo_slab);
lu_kmem_fini(lov_caches);
}
#ifdef __KERNEL__
static void /*__exit*/ lov_exit(void)
{
- int rc;
-
- class_unregister_type(LUSTRE_LOV_NAME);
- rc = cfs_mem_cache_destroy(lov_oinfo_slab);
- LASSERT(rc == 0);
-
+ class_unregister_type(LUSTRE_LOV_NAME);
+ kmem_cache_destroy(lov_oinfo_slab);
lu_kmem_fini(lov_caches);
}