X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fdt_object.c;h=deb5863c6b72eac23e22650a914425eaa2ac0b60;hb=0aec97df129d2c6263c66454ee9039cd5dbfdf85;hp=55b2be31e81ee8782901f8e23936b89717d41947;hpb=3d6a1b79c92933f8d822919229016fbb0122b769;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index 55b2be3..deb5863 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2013, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -808,7 +808,7 @@ int dt_index_walk(const struct lu_env *env, struct dt_object *obj, int i; LASSERT(pageidx < rdpg->rp_npages); - lp = cfs_kmap(rdpg->rp_pages[pageidx]); + lp = kmap(rdpg->rp_pages[pageidx]); /* fill lu pages */ for (i = 0; i < LU_PAGE_COUNT; i++, lp++, nob -= LU_PAGE_SIZE) { @@ -822,7 +822,7 @@ int dt_index_walk(const struct lu_env *env, struct dt_object *obj, /* end of index */ break; } - cfs_kunmap(rdpg->rp_pages[i]); + kunmap(rdpg->rp_pages[i]); } iops->put(env, it); @@ -850,7 +850,7 @@ EXPORT_SYMBOL(dt_index_walk); * \retval appropriate error otherwise. */ int dt_index_read(const struct lu_env *env, struct dt_device *dev, - struct idx_info *ii, const struct lu_rdpg *rdpg) + struct idx_info *ii, const struct lu_rdpg *rdpg) { const struct dt_index_features *feat; struct dt_object *obj; @@ -862,15 +862,15 @@ int dt_index_read(const struct lu_env *env, struct dt_device *dev, if (rdpg->rp_count <= 0 && (rdpg->rp_count & (LU_PAGE_SIZE - 1)) != 0) RETURN(-EFAULT); - if (fid_seq(&ii->ii_fid) < FID_SEQ_SPECIAL) - /* block access to local files */ - RETURN(-EPERM); - if (fid_seq(&ii->ii_fid) >= FID_SEQ_NORMAL) /* we don't support directory transfer via OBD_IDX_READ for the * time being */ RETURN(-EOPNOTSUPP); + if (!fid_is_quota(&ii->ii_fid)) + /* block access to all local files except quota files */ + RETURN(-EPERM); + /* lookup index object subject to the transfer */ obj = dt_locate(env, dev, &ii->ii_fid); if (IS_ERR(obj)) @@ -934,3 +934,122 @@ out: return rc; } EXPORT_SYMBOL(dt_index_read); + +#ifdef LPROCFS + +int lprocfs_dt_rd_blksize(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc == 0) { + *eof = 1; + rc = snprintf(page, count, "%u\n", + (unsigned) osfs.os_bsize); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_blksize); + +int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc == 0) { + __u32 blk_size = osfs.os_bsize >> 10; + __u64 result = osfs.os_blocks; + + while (blk_size >>= 1) + result <<= 1; + + *eof = 1; + rc = snprintf(page, count, LPU64"\n", result); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_kbytestotal); + +int lprocfs_dt_rd_kbytesfree(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc == 0) { + __u32 blk_size = osfs.os_bsize >> 10; + __u64 result = osfs.os_bfree; + + while (blk_size >>= 1) + result <<= 1; + + *eof = 1; + rc = snprintf(page, count, LPU64"\n", result); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_kbytesfree); + +int lprocfs_dt_rd_kbytesavail(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc == 0) { + __u32 blk_size = osfs.os_bsize >> 10; + __u64 result = osfs.os_bavail; + + while (blk_size >>= 1) + result <<= 1; + + *eof = 1; + rc = snprintf(page, count, LPU64"\n", result); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_kbytesavail); + +int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc == 0) { + *eof = 1; + rc = snprintf(page, count, LPU64"\n", osfs.os_files); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_filestotal); + +int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct dt_device *dt = data; + struct obd_statfs osfs; + + int rc = dt_statfs(NULL, dt, &osfs); + if (rc == 0) { + *eof = 1; + rc = snprintf(page, count, LPU64"\n", osfs.os_ffree); + } + + return rc; +} +EXPORT_SYMBOL(lprocfs_dt_rd_filesfree); + +#endif /* LPROCFS */