| 2128 | } |
| 2129 | |
| 2130 | fn alloc_inode(&mut self) -> PristineResult<Inode> { |
| 2131 | if let Some((_, next, _)) = &mut self.preview_allocations { |
| 2132 | let inode = (*next).max(1); |
| 2133 | *next = inode |
| 2134 | .checked_add(1) |
| 2135 | .ok_or(PristineError::IdSpaceExhausted)?; |
| 2136 | return Ok(Inode::new(inode)); |
| 2137 | } |
| 2138 | match self.pending_next_inode.as_mut() { |
| 2139 | Some(pending) => pending.allocate(), |
| 2140 | None => allocate_shared_inode(self.next_inode), |
| 2141 | } |
| 2142 | } |
| 2143 | |
| 2144 | fn put_directory(&mut self, inode: Inode, flags: u8) -> PristineResult<()> { |
| 2145 | let mut table = self.txn.open_table(DIRECTORIES)?; |