Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
b=19051
[fs/lustre-release.git]
/
lustre
/
lclient
/
lcommon_cl.c
diff --git
a/lustre/lclient/lcommon_cl.c
b/lustre/lclient/lcommon_cl.c
index
6b56b4e
..
53eda90
100644
(file)
--- a/
lustre/lclient/lcommon_cl.c
+++ b/
lustre/lclient/lcommon_cl.c
@@
-144,7
+144,7
@@
void *ccc_key_init(const struct lu_context *ctx,
{
struct ccc_thread_info *info;
- OBD_SLAB_ALLOC_PTR
(info, ccc_thread_kmem
);
+ OBD_SLAB_ALLOC_PTR
_GFP(info, ccc_thread_kmem, CFS_ALLOC_IO
);
if (info == NULL)
info = ERR_PTR(-ENOMEM);
return info;
@@
-162,7
+162,7
@@
void *ccc_session_key_init(const struct lu_context *ctx,
{
struct ccc_session *session;
- OBD_SLAB_ALLOC_PTR
(session, ccc_session_kmem
);
+ OBD_SLAB_ALLOC_PTR
_GFP(session, ccc_session_kmem, CFS_ALLOC_IO
);
if (session == NULL)
session = ERR_PTR(-ENOMEM);
return session;
@@
-280,7
+280,7
@@
int ccc_req_init(const struct lu_env *env, struct cl_device *dev,
struct ccc_req *vrq;
int result;
- OBD_SLAB_ALLOC_PTR
(vrq, ccc_req_kmem
);
+ OBD_SLAB_ALLOC_PTR
_GFP(vrq, ccc_req_kmem, CFS_ALLOC_IO
);
if (vrq != NULL) {
cl_req_slice_add(req, &vrq->crq_cl, dev, &ccc_req_ops);
result = 0;
@@
-345,7
+345,7
@@
struct lu_object *ccc_object_alloc(const struct lu_env *env,
struct ccc_object *vob;
struct lu_object *obj;
- OBD_SLAB_ALLOC_PTR
(vob, ccc_object_kmem
);
+ OBD_SLAB_ALLOC_PTR
_GFP(vob, ccc_object_kmem, CFS_ALLOC_IO
);
if (vob != NULL) {
struct cl_object_header *hdr;
@@
-413,7
+413,7
@@
int ccc_lock_init(const struct lu_env *env,
CLOBINVRNT(env, obj, ccc_object_invariant(obj));
- OBD_SLAB_ALLOC_PTR
(clk, ccc_lock_kmem
);
+ OBD_SLAB_ALLOC_PTR
_GFP(clk, ccc_lock_kmem, CFS_ALLOC_IO
);
if (clk != NULL) {
cl_lock_slice_add(lock, &clk->clk_cl, obj, lkops);
result = 0;
@@
-560,11
+560,15
@@
int ccc_transient_page_prep(const struct lu_env *env,
*
*/
+void ccc_lock_delete(const struct lu_env *env,
+ const struct cl_lock_slice *slice)
+{
+ CLOBINVRNT(env, slice->cls_obj, ccc_object_invariant(slice->cls_obj));
+}
+
void ccc_lock_fini(const struct lu_env *env, struct cl_lock_slice *slice)
{
struct ccc_lock *clk = cl2ccc_lock(slice);
-
- CLOBINVRNT(env, slice->cls_obj, ccc_object_invariant(slice->cls_obj));
OBD_SLAB_FREE_PTR(clk, ccc_lock_kmem);
}
@@
-635,7
+639,7
@@
int ccc_lock_fits_into(const struct lu_env *env,
}
/**
- * Implements cl_lock_operations::clo_state() method for
vvp
layer, invoked
+ * Implements cl_lock_operations::clo_state() method for
ccc
layer, invoked
* whenever lock state changes. Transfers object attributes, that might be
* updated as a result of lock acquiring into inode.
*/
@@
-781,10
+785,12
@@
static void ccc_object_size_unlock(struct cl_object *obj, int vfslock)
* the resulting races.
*/
int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
- struct cl_io *io, loff_t pos, int vfslock)
+ struct cl_io *io, loff_t start, size_t count, int vfslock,
+ int *exceed)
{
struct cl_attr *attr = &ccc_env_info(env)->cti_attr;
struct inode *inode = ccc_object_inode(obj);
+ loff_t pos = start + count - 1;
loff_t kms;
int result;
@@
-818,7
+824,21
@@
int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
* of the buffer (C)
*/
ccc_object_size_unlock(obj, vfslock);
- return cl_glimpse_lock(env, io, inode, obj);
+ result = cl_glimpse_lock(env, io, inode, obj);
+ if (result == 0 && exceed != NULL) {
+ /* If objective page index exceed end-of-file
+ * page index, return directly. Do not expect
+ * kernel will check such case correctly.
+ * linux-2.6.18-128.1.1 miss to do that.
+ * --bug 17336 */
+ loff_t size = cl_isize_read(inode);
+ unsigned long cur_index = start >> CFS_PAGE_SHIFT;
+
+ if ((size == 0 && cur_index != 0) ||
+ (((size - 1) >> CFS_PAGE_SHIFT) < cur_index))
+ *exceed = 1;
+ }
+ return result;
} else {
/*
* region is within kms and, hence, within real file
@@
-1155,7
+1175,6
@@
void cl_inode_fini(struct inode *inode)
int emergency;
if (clob != NULL) {
- struct lu_object_header *head = clob->co_lu.lo_header;
void *cookie;
cookie = cl_env_reenter();
@@
-1174,8
+1193,6
@@
void cl_inode_fini(struct inode *inode)
*/
cl_object_kill(env, clob);
lu_object_ref_del(&clob->co_lu, "inode", inode);
- /* XXX temporary: this is racy */
- LASSERT(atomic_read(&head->loh_ref) == 1);
cl_object_put(env, clob);
lli->lli_clob = NULL;
if (emergency) {
@@
-1186,3
+1203,25
@@
void cl_inode_fini(struct inode *inode)
cl_env_reexit(cookie);
}
}
+
+/**
+ * return IF_* type for given lu_dirent entry.
+ * IF_* flag shld be converted to particular OS file type in
+ * platform llite module.
+ */
+__u16 ll_dirent_type_get(struct lu_dirent *ent)
+{
+ __u16 type = 0;
+ struct luda_type *lt;
+ int len = 0;
+
+ if (le32_to_cpu(ent->lde_attrs) & LUDA_TYPE) {
+ const unsigned align = sizeof(struct luda_type) - 1;
+
+ len = le16_to_cpu(ent->lde_namelen);
+ len = (len + align) & ~align;
+ lt = (void *) ent->lde_name + len;
+ type = CFS_IFTODT(le16_to_cpu(lt->lt_type));
+ }
+ return type;
+}