*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
*
* GPL HEADER END
*/
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2015, Intel Corporation.
+ * Copyright (c) 2012, 2016, Intel Corporation.
*/
/*
* lustre/osp/osp_object.c
struct osp_object *obj = dt2osp_obj(dt);
struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
struct osp_xattr_entry *oxe;
- __u16 namelen = strlen(name);
+ __u16 namelen;
int rc = 0;
LASSERT(buf != NULL);
LASSERT(name != NULL);
+ namelen = strlen(name);
+
/* If only for xattr size, return directly. */
if (unlikely(buf->lb_len == 0))
return 0;
return 0;
}
+void osp_obj_invalidate_cache(struct osp_object *obj)
+{
+ struct osp_xattr_entry *oxe;
+ struct osp_xattr_entry *tmp;
+
+ spin_lock(&obj->opo_lock);
+ list_for_each_entry_safe(oxe, tmp, &obj->opo_xattr_list, oxe_list) {
+ oxe->oxe_ready = 0;
+ list_del_init(&oxe->oxe_list);
+ osp_oac_xattr_put(oxe);
+ }
+ obj->opo_attr.la_valid = 0;
+ spin_unlock(&obj->opo_lock);
+}
+
/**
* Implement OSP layer dt_object_operations::do_invalidate() interface.
*
int osp_invalidate(const struct lu_env *env, struct dt_object *dt)
{
struct osp_object *obj = dt2osp_obj(dt);
- struct osp_xattr_entry *oxe;
- struct osp_xattr_entry *tmp;
ENTRY;
+ osp_obj_invalidate_cache(obj);
+
spin_lock(&obj->opo_lock);
- list_for_each_entry_safe(oxe, tmp, &obj->opo_xattr_list, oxe_list) {
- oxe->oxe_ready = 0;
- list_del_init(&oxe->oxe_list);
- osp_oac_xattr_put(oxe);
- }
- obj->opo_attr.la_valid = 0;
obj->opo_stale = 1;
spin_unlock(&obj->opo_lock);
/* 1MB bulk */
npages = min_t(unsigned int, OFD_MAX_BRW_SIZE, 1 << 20);
- npages /= PAGE_CACHE_SIZE;
+ npages /= PAGE_SIZE;
OBD_ALLOC(pages, npages * sizeof(*pages));
if (pages == NULL)
it->ooi_pages = pages;
it->ooi_total_npages = npages;
for (i = 0; i < npages; i++) {
- pages[i] = alloc_page(GFP_IOFS);
+ pages[i] = alloc_page(GFP_NOFS);
if (pages[i] == NULL)
RETURN(-ENOMEM);
}
for (i = 0; i < npages; i++)
desc->bd_frag_ops->add_kiov_frag(desc, pages[i], 0,
- PAGE_CACHE_SIZE);
+ PAGE_SIZE);
ptlrpc_request_set_replen(req);
rc = ptlrpc_queue_wait(req);
GOTO(out, rc = -EPROTO);
npages = (ii->ii_count + LU_PAGE_COUNT - 1) >>
- (PAGE_CACHE_SHIFT - LU_PAGE_SHIFT);
+ (PAGE_SHIFT - LU_PAGE_SHIFT);
if (npages > it->ooi_total_npages) {
CERROR("%s: returned more pages than expected, %u > %u\n",
osp->opd_obd->obd_name, npages, it->ooi_total_npages);