inode link count to zero, instead of just decrementing it.
Use a common name for ll_inode_info variables for clarity.
struct obdo oa;
struct inode *inode;
struct lov_stripe_md *smd = NULL;
- struct ll_inode_info *ii = NULL;
+ struct ll_inode_info *lli = NULL;
ENTRY;
if (dentry->d_it->it_disposition == 0) {
}
if (dentry->d_it->it_disposition) {
- ii = ll_i2info(inode);
- memcpy(&ii->lli_intent_lock_handle,
+ lli = ll_i2info(inode);
+ memcpy(&lli->lli_intent_lock_handle,
dentry->d_it->it_lock_handle,
sizeof(struct lustre_handle));
d_instantiate(dentry, inode);
RETURN(rc);
out_destroy:
-#warning AED: verify that smd is set here
if (smd) {
oa.o_easize = smd->lmd_easize;
+ oa.o_valid |= OBD_MD_FLEASIZE;
err = obd_destroy(ll_i2obdconn(dir), &oa, smd);
if (err)
CERROR("error destroying objid %Ld on error: err %d\n",
{
unsigned l = strlen(symname);
struct inode *inode;
- struct ll_inode_info *oinfo;
+ struct ll_inode_info *lli;
int err = 0;
+ ENTRY;
inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
symname, l, S_IFLNK | S_IRWXUGO, 0,
if (IS_ERR(inode))
RETURN(PTR_ERR(inode));
- oinfo = ll_i2info(inode);
+ lli = ll_i2info(inode);
- OBD_ALLOC(oinfo->lli_symlink_name, l + 1);
- if (!oinfo->lli_symlink_name)
+ OBD_ALLOC(lli->lli_symlink_name, l + 1);
+ /* this _could_ be a non-fatal error, since the symlink is already
+ * stored on the MDS by this point, and we can re-get it in readlink.
+ */
+ if (!lli->lli_symlink_name)
RETURN(-ENOMEM);
- memcpy(oinfo->lli_symlink_name, symname, l + 1);
+ memcpy(lli->lli_symlink_name, symname, l + 1);
inode->i_size = l;
/* no directory data updates when intents rule */
else
err = ext2_add_nondir(dentry, inode);
- return err;
+ RETURN(err);
}
static int ll_link(struct dentry *old_dentry, struct inode * dir,
if (dentry->d_it && dentry->d_it->it_disposition) {
err = dentry->d_it->it_status;
- if (!err)
- inode->i_nlink = 0;
GOTO(out, err);
}
goto out;
inode->i_ctime = dir->i_ctime;
- ext2_dec_count(inode);
out:
+ ext2_dec_count(inode);
return err;
}
*
* Lustre Lite I/O Page Cache
*
- * Copyright (C) 2002 Cluster File Systems, Inc.
+ * Copyright (C) 2002 Cluster File Systems, Inc.
*/
#include <linux/config.h>
/* SYNCHRONOUS I/O to object storage for an inode */
static int ll_brw(int rw, struct inode *inode, struct page *page, int create)
{
- struct ll_inode_info *lii = ll_i2info(inode);
- struct lov_stripe_md *md = lii->lli_smd;
- struct brw_page pg;
- int err;
+ struct ll_inode_info *lli = ll_i2info(inode);
+ struct lov_stripe_md *md = lli->lli_smd;
+ struct brw_page pg;
+ int err;
struct io_cb_data *cbd = ll_init_cb();
ENTRY;
- if (!cbd)
- RETURN(-ENOMEM);
+
+ if (!cbd)
+ RETURN(-ENOMEM);
pg.pg = page;
pg.count = PAGE_SIZE;
pg.flag = create ? OBD_BRW_CREATE : 0;
err = obd_brw(rw, ll_i2obdconn(inode), md, 1, &pg, ll_sync_io_cb, cbd);
+
RETURN(err);
} /* ll_brw */
//obd_off offset = ((obd_off)page->index) << PAGE_SHIFT;
int rc = 0;
char *addr;
- ENTRY;
-
+ ENTRY;
+
addr = kmap(page);
if (!PageLocked(page))
LBUG();
* to date until commit_write */
if (from == 0 && to == PAGE_SIZE)
RETURN(0);
-
+
/* prepare write should not read what lies beyond the end of
the file */
rc = ll_brw(OBD_BRW_READ, inode, page, 0);
} else {
CERROR("ll_brw failure %d\n", err);
}
- UnlockPage(page);
+ UnlockPage(page);
RETURN(err);
}
{
int create = 1;
struct inode *inode = page->mapping->host;
- struct ll_inode_info *lii = ll_i2info(inode);
- struct lov_stripe_md *md = lii->lli_smd;
+ struct ll_inode_info *lli = ll_i2info(inode);
+ struct lov_stripe_md *md = lli->lli_smd;
struct brw_page pg;
int err;
struct iattr iattr;
1, &pg, ll_sync_io_cb, cbd);
kunmap(page);
- if (err)
- GOTO(out, err);
-
iattr.ia_size = pg.off + pg.count;
if (iattr.ia_size > inode->i_size) {
/* do NOT truncate when writing in the middle of a file */
}
#endif
}
-out:
RETURN(err);
} /* ll_commit_write */
int err;
ENTRY;
- if (!md) {
+ if (!md) {
/* object not yet allocated */
inode->i_mtime = inode->i_ctime = CURRENT_TIME;
return;
unsigned long blocknr, int blocksize)
{
obd_count bufs_per_obdo = iobuf->nr_pages;
- struct ll_inode_info *lii = ll_i2info(inode);
- struct lov_stripe_md *md = lii->lli_smd;
+ struct ll_inode_info *lli = ll_i2info(inode);
+ struct lov_stripe_md *md = lli->lli_smd;
struct brw_page *pga;
int rc = 0;
int i;
{
struct ll_inode_md *md = opaque;
struct mds_body *body = md->body;
- struct ll_inode_info *ii = ll_i2info(inode);
+ struct ll_inode_info *lli = ll_i2info(inode);
ENTRY;
- sema_init(&ii->lli_open_sem, 1);
+ sema_init(&lli->lli_open_sem, 1);
/* core attributes first */
if (body->valid & OBD_MD_FLID)
inode->i_ino);
LBUG();
}
- size = sizeof(*ii->lli_smd) +
+ size = sizeof(*lli->lli_smd) +
md->md->lmd_stripe_count * sizeof(struct lov_oinfo);
- OBD_ALLOC(ii->lli_smd, size);
- if (!ii->lli_smd) {
+ OBD_ALLOC(lli->lli_smd, size);
+ if (!lli->lli_smd) {
CERROR("No memory for %d\n", size);
LBUG();
}
- lov_unpackmd(ii->lli_smd, smd);
+ lov_unpackmd(lli->lli_smd, smd);
} else {
- ii->lli_smd = NULL;
+ lli->lli_smd = NULL;
}
/* Get the authoritative file size */
- if (ii->lli_smd && (inode->i_mode & S_IFREG)) {
+ if (lli->lli_smd && (inode->i_mode & S_IFREG)) {
int rc;
- rc = ll_file_size(inode, ii->lli_smd, &inode->i_size);
+ rc = ll_file_size(inode, lli->lli_smd, &inode->i_size);
if (rc) {
CERROR("ll_file_size: %d\n", rc);
/* FIXME: need to somehow prevent inode creation */