Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 07fd4cd1 in mainline


Ignore:
Timestamp:
2011-12-03T10:50:16Z (10 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master
Children:
b8b1e631
Parents:
2449396
Message:

Finished deleting with timestamp hack

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/ext4fs/ext4fs_ops.c

    r2449396 r07fd4cd1  
    401401        ext4_inode_ref_t *inode_ref = enode->inode_ref;
    402402
    403 //      EXT4FS_DBG("destroying \%u", inode_ref->index);
    404 
    405403        rc = ext4_filesystem_truncate_inode(fs, inode_ref, 0);
    406404        if (rc != EOK) {
     
    408406                return rc;
    409407        }
     408
     409        uint32_t rev_level = ext4_superblock_get_rev_level(fs->superblock);
     410        if (rev_level > 0) {
     411                ext4_filesystem_delete_orphan(fs, inode_ref);
     412        }
     413
     414
     415        // TODO set real deletion time
     416//      time_t now = time(NULL);
     417        time_t now = ext4_inode_get_change_inode_time(inode_ref->inode);
     418        ext4_inode_set_deletion_time(inode_ref->inode, (uint32_t)now);
     419        inode_ref->dirty = true;
    410420
    411421        rc = ext4_filesystem_free_inode(fs, inode_ref);
     
    444454        // Cannot unlink non-empty node
    445455        if (has_children) {
    446                 EXT4FS_DBG("\%s is not empty", name);
    447456                return ENOTEMPTY;
    448457        }
     
    471480                ext4_inode_ref_t *parent_inode_ref = EXT4FS_NODE(pfn)->inode_ref;
    472481
    473 //              EXT4FS_DBG("parent index = \%u", parent_inode_ref->index);
    474 
    475482                uint32_t parent_lnk_count = ext4_inode_get_links_count(
    476483                                parent_inode_ref->inode);
     
    479486                ext4_inode_set_links_count(parent_inode_ref->inode, parent_lnk_count);
    480487
    481                 parent_inode_ref->dirty = true;
    482         }
    483 
     488                parent->dirty = true;
     489        }
     490
     491        uint32_t rev_level = ext4_superblock_get_rev_level(fs->superblock);
     492        if ((rev_level > 0) && (lnk_count == 0)) {
     493                ext4_filesystem_add_orphan(fs, child_inode_ref);
     494        }
     495
     496        // TODO set timestamps for parent (when we have wall-clock time)
     497//      time_t now = time(NULL);
     498//      ext4_inode_set_change_inode_time(parent->inode, (uint32_t)now);
     499//      ext4_inode_set_modification_time(parent->inode, (uint32_t)now);
     500//      parent->dirty = true;
     501
     502        // TODO set timestamp for inode
     503//      ext4_inode_set_change_inode_time(child_inode_ref->inode, (uint32_t)now);
    484504        ext4_inode_set_links_count(child_inode_ref->inode, lnk_count);
    485505        child_inode_ref->dirty = true;
Note: See TracChangeset for help on using the changeset viewer.