pnfs: support for mdsthreshold attribute

hacked up and tested against bluearc server

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-02-25 11:44:41 -08:00 committed by unknown
parent e3c67c0bfa
commit 0c2148da5b
2 changed files with 72 additions and 0 deletions

View file

@ -247,6 +247,52 @@ static bool_t xdr_layout_types(
return TRUE;
}
static bool_t xdr_threshold_item(
XDR *xdr,
threshold_item4 *item)
{
bitmap4 bitmap;
if (!xdr_u_int32_t(xdr, &item->type))
return FALSE;
if (!xdr_bitmap4(xdr, &bitmap))
return FALSE;
if (!xdr_u_int32_t(xdr, &bitmap.count))
return FALSE;
if (bitmap.count) {
if (bitmap.arr[0] & 0x1 && !xdr_u_hyper(xdr, &item->hints[0]))
return FALSE;
if (bitmap.arr[0] & 0x2 && !xdr_u_hyper(xdr, &item->hints[1]))
return FALSE;
if (bitmap.arr[0] & 0x4 && !xdr_u_hyper(xdr, &item->hints[2]))
return FALSE;
if (bitmap.arr[0] & 0x8 && !xdr_u_hyper(xdr, &item->hints[3]))
return FALSE;
}
return TRUE;
}
static bool_t xdr_mdsthreshold(
XDR *xdr,
mdsthreshold4 *mdsthreshold)
{
uint32_t i;
if (!xdr_u_int32_t(xdr, &mdsthreshold->count))
return FALSE;
if (mdsthreshold->count > MAX_MDSTHRESHOLD_ITEMS)
return FALSE;
for (i = 0; i < mdsthreshold->count; i++)
if (!xdr_threshold_item(xdr, &mdsthreshold->items[i]))
return FALSE;
return TRUE;
}
/* pathname4
* decode a variable array of components into a nfs41_abs_path */
static bool_t decode_pathname4(
@ -1652,6 +1698,12 @@ static bool_t decode_file_attrs(
return FALSE;
}
}
if (attrs->attrmask.count >= 3) {
if (attrs->attrmask.arr[2] & FATTR4_WORD2_MDSTHRESHOLD) {
if (!xdr_mdsthreshold(xdr, &info->mdsthreshold))
return FALSE;
}
}
return TRUE;
}