Whamcloud - gitweb
LU-5814 llite: add cl_object_maxbytes()
[fs/lustre-release.git] / lustre / lov / lov_object.c
index c852ab5..21c24c2 100644 (file)
@@ -1599,6 +1599,22 @@ static int lov_object_layout_get(const struct lu_env *env,
        RETURN(rc < 0 ? rc : 0);
 }
 
+static loff_t lov_object_maxbytes(struct cl_object *obj)
+{
+       struct lov_object *lov = cl2lov(obj);
+       struct lov_stripe_md *lsm = lov_lsm_addref(lov);
+       loff_t maxbytes;
+
+       if (lsm == NULL)
+               return LLONG_MAX;
+
+       maxbytes = lsm->lsm_maxbytes;
+
+       lov_lsm_put(lsm);
+
+       return maxbytes;
+}
+
 static int lov_object_find_cbdata(const struct lu_env *env,
                                  struct cl_object *obj, ldlm_iterator_t iter,
                                  void *data)
@@ -1621,6 +1637,7 @@ static const struct cl_object_operations lov_ops = {
        .coo_conf_set     = lov_conf_set,
        .coo_getstripe    = lov_object_getstripe,
        .coo_layout_get   = lov_object_layout_get,
+       .coo_maxbytes     = lov_object_maxbytes,
        .coo_find_cbdata  = lov_object_find_cbdata,
        .coo_fiemap       = lov_object_fiemap,
        .coo_data_version = lov_object_data_version,