LAFS_BUG(test_bit(B_Pinned, &b->b.flags) &&
b->b.parent == NULL,
&b->b);
-
- if (test_bit(B_PhysValid, &b->b.flags)
- && (!adopt || b->b.parent || test_bit(B_Root, &b->b.flags))) {
- return 0;
- }
if (b->b.inode == NULL)
return 0;
lai = LAFSI(b->b.inode);
if (lai->depth == 0) {
/* Data is in the inode if anywhere */
- b->b.physaddr = 0;
- set_bit(B_PhysValid, &b->b.flags);
+ if (!test_bit(B_PhysValid, &b->b.flags)) {
+ b->b.physaddr = 0;
+ set_bit(B_PhysValid, &b->b.flags);
+ }
db = lafs_inode_dblock(b->b.inode, async, MKREF(findblock));
if (IS_ERR(db))
return PTR_ERR(db);
- if (!test_bit(B_Valid, &b->b.flags) && b->b.fileaddr == 0)
+ if (!test_bit(B_Valid, &b->b.flags) && b->b.fileaddr == 0) {
/* Now is the best time to copy data from inode into
* datablock, as we know we have a valid inode block
* now.
*/
+ LAFS_BUG(b->b.physaddr != 0, &b->b);
fill_block_zero(b, db);
+ }
if (adopt) {
ib = lafs_make_iblock(b->b.inode, adopt, async,
MKREF(findblock));
putdref(db, MKREF(findblock));
return 0;
}
+
+ if (test_bit(B_PhysValid, &b->b.flags)
+ && (!adopt || b->b.parent || test_bit(B_Root, &b->b.flags))) {
+ return 0;
+ }
+
db = lafs_inode_dblock(b->b.inode, async, MKREF(findblock));
if (IS_ERR(db))
return PTR_ERR(db);