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
More makefile fixes.
[fs/lustre-release.git]
/
lustre
/
llite
/
dir.c
diff --git
a/lustre/llite/dir.c
b/lustre/llite/dir.c
index
8e3141c
..
456f6f1
100644
(file)
--- a/
lustre/llite/dir.c
+++ b/
lustre/llite/dir.c
@@
-64,6
+64,7
@@
static int ll_dir_readpage(struct file *file, struct page *page)
int rc = 0;
struct ptlrpc_request *request;
struct lustre_handle lockh;
int rc = 0;
struct ptlrpc_request *request;
struct lustre_handle lockh;
+ struct mds_body *body;
struct lookup_intent it = {IT_READDIR};
ENTRY;
struct lookup_intent it = {IT_READDIR};
ENTRY;
@@
-77,11
+78,13
@@
static int ll_dir_readpage(struct file *file, struct page *page)
rc = ll_lock(inode, NULL, &it, &lockh);
request = (struct ptlrpc_request *)it.it_data;
ptlrpc_free_req(request);
rc = ll_lock(inode, NULL, &it, &lockh);
request = (struct ptlrpc_request *)it.it_data;
ptlrpc_free_req(request);
- if (rc != ELDLM_OK)
+ if (rc != ELDLM_OK)
{
CERROR("lock enqueue: err: %d\n", rc);
CERROR("lock enqueue: err: %d\n", rc);
+ UnlockPage(page);
+ RETURN(rc);
+ }
ldlm_lock_dump((void *)(unsigned long)lockh.addr);
ldlm_lock_dump((void *)(unsigned long)lockh.addr);
-
if (Page_Uptodate(page)) {
CERROR("Explain this please?\n");
GOTO(readpage_out, rc);
if (Page_Uptodate(page)) {
CERROR("Explain this please?\n");
GOTO(readpage_out, rc);
@@
-92,6
+95,11
@@
static int ll_dir_readpage(struct file *file, struct page *page)
rc = mdc_readpage(&sbi->ll_mdc_conn, inode->i_ino,
S_IFDIR, offset, buf, &request);
kunmap(page);
rc = mdc_readpage(&sbi->ll_mdc_conn, inode->i_ino,
S_IFDIR, offset, buf, &request);
kunmap(page);
+ body = lustre_msg_buf(request->rq_repmsg, 0);
+ if (!body)
+ rc = -EINVAL;
+ if (body)
+ inode->i_size = body->size;
ptlrpc_free_req(request);
EXIT;
ptlrpc_free_req(request);
EXIT;
@@
-186,6
+194,8
@@
static void ext2_check_page(struct page *page)
for (offs = limit; offs<PAGE_CACHE_SIZE; offs += chunk_size) {
ext2_dirent *p = (ext2_dirent*)(kaddr + offs);
p->rec_len = cpu_to_le16(chunk_size);
for (offs = limit; offs<PAGE_CACHE_SIZE; offs += chunk_size) {
ext2_dirent *p = (ext2_dirent*)(kaddr + offs);
p->rec_len = cpu_to_le16(chunk_size);
+ p->name_len = 0;
+ p->inode = 0;
}
if (!limit)
goto out;
}
if (!limit)
goto out;
@@
-347,8
+357,7
@@
static inline void ext2_set_de_type(ext2_dirent *de, struct inode *inode)
de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
}
de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
}
-int
-ll_readdir (struct file * filp, void * dirent, filldir_t filldir)
+int ll_readdir(struct file * filp, void * dirent, filldir_t filldir)
{
loff_t pos = filp->f_pos;
struct inode *inode = filp->f_dentry->d_inode;
{
loff_t pos = filp->f_pos;
struct inode *inode = filp->f_dentry->d_inode;
@@
-359,6
+368,7
@@
ll_readdir (struct file * filp, void * dirent, filldir_t filldir)
unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
unsigned char *types = NULL;
int need_revalidate = (filp->f_version != inode->i_version);
unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
unsigned char *types = NULL;
int need_revalidate = (filp->f_version != inode->i_version);
+ ENTRY;
if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
GOTO(done, 0);
if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
GOTO(done, 0);
@@
-370,6
+380,9
@@
ll_readdir (struct file * filp, void * dirent, filldir_t filldir)
ext2_dirent *de;
struct page *page = ext2_get_page(inode, n);
ext2_dirent *de;
struct page *page = ext2_get_page(inode, n);
+ /* size might have been updated by mdc_readpage */
+ npages = dir_pages(inode);
+
if (IS_ERR(page))
continue;
kaddr = page_address(page);
if (IS_ERR(page))
continue;
kaddr = page_address(page);
@@
-403,7
+416,7
@@
done:
filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
filp->f_version = inode->i_version;
UPDATE_ATIME(inode);
filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
filp->f_version = inode->i_version;
UPDATE_ATIME(inode);
-
return 0
;
+
RETURN(0)
;
}
/*
}
/*