From d349e40473998829aa20e5279265e343c02748ea Mon Sep 17 00:00:00 2001 From: kalpak Date: Fri, 8 Aug 2008 08:27:09 +0000 Subject: [PATCH] b=10555 i=adilger i=green i=girish add ldiskfs patches and lustre support for FIEMAP ioctl --- lustre/obdfilter/filter.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 945cb5d..b04690d 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -76,6 +76,7 @@ #include #include #include +#include #include "filter_internal.h" @@ -3678,6 +3679,38 @@ static int filter_get_info(struct obd_export *exp, __u32 keylen, RETURN(0); } + if (KEY_IS(KEY_FIEMAP)) { + struct ll_fiemap_info_key *fm_key = key; + struct dentry *dentry; + struct ll_user_fiemap *fiemap = val; + struct lvfs_run_ctxt saved; + int rc; + + if (fiemap == NULL) { + *vallen = fiemap_count_to_size( + fm_key->fiemap.fm_extent_count); + RETURN(0); + } + + dentry = __filter_oa2dentry(exp->exp_obd, &fm_key->oa, + __FUNCTION__, 1); + if (IS_ERR(dentry)) + RETURN(PTR_ERR(dentry)); + + memcpy(fiemap, &fm_key->fiemap, sizeof(*fiemap)); + push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + rc = fsfilt_iocontrol(obd, dentry->d_inode, NULL, + EXT3_IOC_FIEMAP, (long)fiemap); + if (rc) { + f_dput(dentry); + RETURN(rc); + } + pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + + f_dput(dentry); + RETURN(0); + } + CDEBUG(D_IOCTL, "invalid key\n"); RETURN(-EINVAL); } -- 1.8.3.1