version 1.36.8.2, 2007/10/14 11:48:35 |
version 1.37, 2007/09/24 00:42:15 |
Line 359 udf_read_descriptor(struct udf_mount *um |
|
Line 359 udf_read_descriptor(struct udf_mount *um |
|
if (i == sector_size) { |
if (i == sector_size) { |
/* return no error but with no dscrptr */ |
/* return no error but with no dscrptr */ |
/* dispose first block */ |
/* dispose first block */ |
brelse(bp, 0); |
brelse(bp); |
return 0; |
return 0; |
} |
} |
} |
} |
Line 372 udf_read_descriptor(struct udf_mount *um |
|
Line 372 udf_read_descriptor(struct udf_mount *um |
|
memcpy(dst, src, sector_size); |
memcpy(dst, src, sector_size); |
} |
} |
/* dispose first block */ |
/* dispose first block */ |
brelse(bp, BC_AGE); |
bp->b_flags |= B_AGE; |
|
brelse(bp); |
|
|
if (!error && (dscrlen > sector_size)) { |
if (!error && (dscrlen > sector_size)) { |
DPRINTF(DESCRIPTOR, ("multi block descriptor read\n")); |
DPRINTF(DESCRIPTOR, ("multi block descriptor read\n")); |
Line 385 udf_read_descriptor(struct udf_mount *um |
|
Line 386 udf_read_descriptor(struct udf_mount *um |
|
for (blk = 1; blk < blks; blk++) { |
for (blk = 1; blk < blks; blk++) { |
error = udf_bread(ump, sector + blk, &bp); |
error = udf_bread(ump, sector + blk, &bp); |
if (error) { |
if (error) { |
brelse(bp, 0); |
brelse(bp); |
break; |
break; |
} |
} |
pos = (uint8_t *) dst + blk*sector_size; |
pos = (uint8_t *) dst + blk*sector_size; |
memcpy(pos, bp->b_data, sector_size); |
memcpy(pos, bp->b_data, sector_size); |
|
|
/* dispose block */ |
/* dispose block */ |
brelse(bp, BC_AGE); |
bp->b_flags |= B_AGE; |
|
brelse(bp); |
} |
} |
DPRINTFIF(DESCRIPTOR, error, ("read error on multi (%d)\n", |
DPRINTFIF(DESCRIPTOR, error, ("read error on multi (%d)\n", |
error)); |
error)); |
Line 1367 udf_read_sparables(struct udf_mount *ump |
|
Line 1369 udf_read_sparables(struct udf_mount *ump |
|
/* --------------------------------------------------------------------- */ |
/* --------------------------------------------------------------------- */ |
|
|
#define UDF_SET_SYSTEMFILE(vp) \ |
#define UDF_SET_SYSTEMFILE(vp) \ |
/* XXXAD Is the vnode locked? */ \ |
simple_lock(&(vp)->v_interlock); \ |
(vp)->v_vflag |= VV_SYSTEM; \ |
(vp)->v_flag |= VSYSTEM; \ |
|
simple_unlock(&(vp)->v_interlock);\ |
vref(vp); \ |
vref(vp); \ |
vput(vp); \ |
vput(vp); \ |
|
|
Line 1775 udf_hashget(struct udf_mount *ump, struc |
|
Line 1778 udf_hashget(struct udf_mount *ump, struc |
|
uint32_t hashline; |
uint32_t hashline; |
|
|
loop: |
loop: |
mutex_enter(&ump->ihash_lock); |
simple_lock(&ump->ihash_slock); |
|
|
hashline = udf_calchash(icbptr) & UDF_INODE_HASHMASK; |
hashline = udf_calchash(icbptr) & UDF_INODE_HASHMASK; |
LIST_FOREACH(unp, &ump->udf_nodes[hashline], hashchain) { |
LIST_FOREACH(unp, &ump->udf_nodes[hashline], hashchain) { |
|
|
vp = unp->vnode; |
vp = unp->vnode; |
assert(vp); |
assert(vp); |
simple_lock(&vp->v_interlock); |
simple_lock(&vp->v_interlock); |
mutex_exit(&ump->ihash_lock); |
simple_unlock(&ump->ihash_slock); |
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK)) |
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK)) |
goto loop; |
goto loop; |
return unp; |
return unp; |
} |
} |
} |
} |
mutex_exit(&ump->ihash_lock); |
simple_unlock(&ump->ihash_slock); |
|
|
return NULL; |
return NULL; |
} |
} |
Line 1805 udf_hashins(struct udf_node *unp) |
|
Line 1808 udf_hashins(struct udf_node *unp) |
|
uint32_t hashline; |
uint32_t hashline; |
|
|
ump = unp->ump; |
ump = unp->ump; |
mutex_enter(&ump->ihash_lock); |
simple_lock(&ump->ihash_slock); |
|
|
hashline = udf_calchash(&unp->loc) & UDF_INODE_HASHMASK; |
hashline = udf_calchash(&unp->loc) & UDF_INODE_HASHMASK; |
LIST_INSERT_HEAD(&ump->udf_nodes[hashline], unp, hashchain); |
LIST_INSERT_HEAD(&ump->udf_nodes[hashline], unp, hashchain); |
|
|
mutex_exit(&ump->ihash_lock); |
simple_unlock(&ump->ihash_slock); |
} |
} |
|
|
/* --------------------------------------------------------------------- */ |
/* --------------------------------------------------------------------- */ |
Line 1821 udf_hashrem(struct udf_node *unp) |
|
Line 1824 udf_hashrem(struct udf_node *unp) |
|
struct udf_mount *ump; |
struct udf_mount *ump; |
|
|
ump = unp->ump; |
ump = unp->ump; |
mutex_enter(&ump->ihash_lock); |
simple_lock(&ump->ihash_slock); |
|
|
LIST_REMOVE(unp, hashchain); |
LIST_REMOVE(unp, hashchain); |
|
|
mutex_exit(&ump->ihash_lock); |
simple_unlock(&ump->ihash_slock); |
} |
} |
|
|
/* --------------------------------------------------------------------- */ |
/* --------------------------------------------------------------------- */ |
Line 1969 udf_get_node(struct udf_mount *ump, stru |
|
Line 1972 udf_get_node(struct udf_mount *ump, stru |
|
*noderes = node = NULL; |
*noderes = node = NULL; |
|
|
/* lock to disallow simultanious creation of same node */ |
/* lock to disallow simultanious creation of same node */ |
mutex_enter(&ump->get_node_lock); |
lockmgr(&ump->get_node_lock, LK_EXCLUSIVE, NULL); |
|
|
DPRINTF(NODE, ("\tlookup in hash table\n")); |
DPRINTF(NODE, ("\tlookup in hash table\n")); |
/* lookup in hash table */ |
/* lookup in hash table */ |
Line 1980 udf_get_node(struct udf_mount *ump, stru |
|
Line 1983 udf_get_node(struct udf_mount *ump, stru |
|
DPRINTF(NODE, ("\tgot it from the hash!\n")); |
DPRINTF(NODE, ("\tgot it from the hash!\n")); |
/* vnode is returned locked */ |
/* vnode is returned locked */ |
*noderes = node; |
*noderes = node; |
mutex_exit(&ump->get_node_lock); |
lockmgr(&ump->get_node_lock, LK_RELEASE, NULL); |
return 0; |
return 0; |
} |
} |
|
|
Line 1988 udf_get_node(struct udf_mount *ump, stru |
|
Line 1991 udf_get_node(struct udf_mount *ump, stru |
|
error = udf_translate_vtop(ump, node_icb_loc, §or, &dummy); |
error = udf_translate_vtop(ump, node_icb_loc, §or, &dummy); |
if (error) { |
if (error) { |
/* no use, this will fail anyway */ |
/* no use, this will fail anyway */ |
mutex_exit(&ump->get_node_lock); |
lockmgr(&ump->get_node_lock, LK_RELEASE, NULL); |
return EINVAL; |
return EINVAL; |
} |
} |
|
|
Line 2001 udf_get_node(struct udf_mount *ump, stru |
|
Line 2004 udf_get_node(struct udf_mount *ump, stru |
|
error = getnewvnode(VT_UDF, ump->vfs_mountp, udf_vnodeop_p, &nvp); |
error = getnewvnode(VT_UDF, ump->vfs_mountp, udf_vnodeop_p, &nvp); |
if (error) { |
if (error) { |
pool_put(&udf_node_pool, node); |
pool_put(&udf_node_pool, node); |
mutex_exit(&ump->get_node_lock); |
lockmgr(&ump->get_node_lock, LK_RELEASE, NULL); |
return error; |
return error; |
} |
} |
|
|
Line 2009 udf_get_node(struct udf_mount *ump, stru |
|
Line 2012 udf_get_node(struct udf_mount *ump, stru |
|
if ((error = vn_lock(nvp, LK_EXCLUSIVE | LK_RETRY))) { |
if ((error = vn_lock(nvp, LK_EXCLUSIVE | LK_RETRY))) { |
/* recycle vnode and unlock; simultanious will fail too */ |
/* recycle vnode and unlock; simultanious will fail too */ |
ungetnewvnode(nvp); |
ungetnewvnode(nvp); |
mutex_exit(&ump->get_node_lock); |
lockmgr(&ump->get_node_lock, LK_RELEASE, NULL); |
return error; |
return error; |
} |
} |
|
|
Line 2024 udf_get_node(struct udf_mount *ump, stru |
|
Line 2027 udf_get_node(struct udf_mount *ump, stru |
|
udf_hashins(node); |
udf_hashins(node); |
|
|
/* safe to unlock, the entry is in the hash table, vnode is locked */ |
/* safe to unlock, the entry is in the hash table, vnode is locked */ |
mutex_exit(&ump->get_node_lock); |
lockmgr(&ump->get_node_lock, LK_RELEASE, NULL); |
|
|
icb_loc = *node_icb_loc; |
icb_loc = *node_icb_loc; |
needs_indirect = 0; |
needs_indirect = 0; |