[Pvfs2-cvs] commit by slang in pvfs2/src/io/trove/trove-dbpf:
dbpf-bstream-direct.c
CVS commit program
cvs at parl.clemson.edu
Wed Sep 24 18:41:53 EDT 2008
Update of /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf
In directory parlweb1:/tmp/cvs-serv22964/src/io/trove/trove-dbpf
Modified Files:
Tag: directio-branch
dbpf-bstream-direct.c
Log Message:
fix for removes so that putting fd reference back in the cache works.
Index: dbpf-bstream-direct.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/Attic/dbpf-bstream-direct.c,v
diff -p -u -r1.1.2.8 -r1.1.2.9
--- dbpf-bstream-direct.c 2 Sep 2008 18:13:13 -0000 1.1.2.8
+++ dbpf-bstream-direct.c 24 Sep 2008 22:41:53 -0000 1.1.2.9
@@ -674,7 +674,7 @@ static int dbpf_bstream_direct_read_op_s
ret = dbpf_dspace_attr_get(qop_p->op.coll_p, ref, &attr);
if(ret != 0)
{
- return ret;
+ goto done;
}
ret = dbpf_bstream_get_extents(
@@ -688,7 +688,7 @@ static int dbpf_bstream_direct_read_op_s
NULL);
if(ret != 0)
{
- return ret;
+ goto done;
}
stream_extents = malloc(sizeof(*stream_extents) * extent_count);
@@ -709,7 +709,7 @@ static int dbpf_bstream_direct_read_op_s
if(ret != 0)
{
free(stream_extents);
- return ret;
+ goto done;
}
for(i = 0; i < extent_count; ++ i)
@@ -723,10 +723,16 @@ static int dbpf_bstream_direct_read_op_s
if(ret < 0)
{
free(stream_extents);
- return -trove_errno_to_trove_error(-ret);
+ ret = -trove_errno_to_trove_error(-ret);
+ goto done;
}
}
- return DBPF_OP_COMPLETE;
+
+ ret = DBPF_OP_COMPLETE;
+
+done:
+ dbpf_open_cache_put(&rw_op->open_ref);
+ return ret;
}
static int dbpf_bstream_direct_write_op_svc(void *ptr, PVFS_hint *hint)
@@ -758,13 +764,14 @@ static int dbpf_bstream_direct_write_op_
NULL);
if(ret != 0)
{
- return ret;
+ goto cache_put;
}
stream_extents = malloc(sizeof(*stream_extents) * extent_count);
if(!stream_extents)
{
- return -TROVE_ENOMEM;
+ ret = -TROVE_ENOMEM;
+ goto cache_put;
}
ret = dbpf_bstream_get_extents(
@@ -779,13 +786,13 @@ static int dbpf_bstream_direct_write_op_
if(ret != 0)
{
free(stream_extents);
- return ret;
+ goto cache_put;
}
ret = dbpf_dspace_attr_get(qop_p->op.coll_p, ref, &attr);
if(ret != 0)
{
- return ret;
+ goto cache_put;
}
*rw_op->out_size_p = 0;
@@ -799,7 +806,7 @@ static int dbpf_bstream_direct_write_op_
attr.u.datafile.b_size);
if(ret < 0)
{
- return ret;
+ goto cache_put;
}
if(eor < stream_extents[i].offset + stream_extents[i].size)
@@ -819,7 +826,7 @@ static int dbpf_bstream_direct_write_op_
if(ret != 0)
{
gen_mutex_unlock(&dbpf_update_size_lock);
- return ret;
+ goto cache_put;
}
if(eor > attr.u.datafile.b_size)
@@ -830,7 +837,7 @@ static int dbpf_bstream_direct_write_op_
if(ret != 0)
{
gen_mutex_unlock(&dbpf_update_size_lock);
- return ret;
+ goto cache_put;
}
sync_required = 1;
}
@@ -838,6 +845,8 @@ static int dbpf_bstream_direct_write_op_
if(sync_required == 1)
{
+ dbpf_open_cache_put(&rw_op->open_ref);
+
/* We want to hit the coalesce path, so we queue up the setattr */
dbpf_queued_op_init(qop_p,
DSPACE_SETATTR,
@@ -848,11 +857,21 @@ static int dbpf_bstream_direct_write_op_
TROVE_SYNC,
qop_p->op.context_id);
ret = dbpf_sync_coalesce(qop_p, 0, &outcount);
+ if(ret < 0)
+ {
+ goto done;
+ }
+
return PINT_MGMT_OP_CONTINUE;
}
}
- return PINT_MGMT_OP_COMPLETED;
+ ret = PINT_MGMT_OP_COMPLETED;
+
+cache_put:
+ dbpf_open_cache_put(&rw_op->open_ref);
+done:
+ return ret;
}
static int dbpf_bstream_direct_read_at(TROVE_coll_id coll_id,
@@ -1055,13 +1074,14 @@ static int dbpf_bstream_direct_resize_op
ret = dbpf_dspace_attr_get(op_p->coll_p, ref, &attr);
if(ret != 0)
{
- return ret;
+ goto done;
}
ret = ftruncate(op_p->u.b_resize.open_ref.fd, op_p->u.b_resize.size);
if(ret == -1)
{
- return -trove_errno_to_trove_error(errno);
+ ret = -trove_errno_to_trove_error(errno);
+ goto done;
}
attr.u.datafile.b_size = op_p->u.b_resize.size;
@@ -1078,14 +1098,19 @@ static int dbpf_bstream_direct_resize_op
if(!op_p->u.d_setattr.attr_p)
{
dbpf_queued_op_free(q_op_p);
- return -TROVE_ENOMEM;
+ ret = -TROVE_ENOMEM;
+ goto done;
}
*op_p->u.d_setattr.attr_p = attr;
/* we don't have to add the op back to the queue, the dbpf_thread does
* that for us when we return 0 instead of 1
*/
- return DBPF_OP_CONTINUE;
+ ret = DBPF_OP_CONTINUE;
+
+done:
+ dbpf_open_cache_put(&op_p->u.b_resize.open_ref);
+ return ret;
}
static int dbpf_bstream_direct_resize(TROVE_coll_id coll_id,
More information about the Pvfs2-cvs
mailing list