Adds support for INODE_DONT_FREE_SPACE, and all private BFS ioctls defined
in bfs_control.h. Some minor cleanups. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1993 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
54b7cbe14d
commit
27fe0a4b4b
@ -12,6 +12,7 @@
|
||||
#include "Index.h"
|
||||
#include "BPlusTree.h"
|
||||
#include "Query.h"
|
||||
#include "bfs_control.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@ -359,7 +360,7 @@ bfs_sync(void *_ns)
|
||||
*/
|
||||
|
||||
static int
|
||||
bfs_read_vnode(void *_ns, vnode_id id, char reenter, void **node)
|
||||
bfs_read_vnode(void *_ns, vnode_id id, char reenter, void **_node)
|
||||
{
|
||||
FUNCTION_START(("vnode_id = %Ld\n", id));
|
||||
Volume *volume = (Volume *)_ns;
|
||||
@ -374,7 +375,7 @@ bfs_read_vnode(void *_ns, vnode_id id, char reenter, void **node)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
if (inode->InitCheck() == B_OK) {
|
||||
*node = (void *)inode;
|
||||
*_node = (void *)inode;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -406,6 +407,13 @@ bfs_remove_vnode(void *_ns, void *_node, char reenter)
|
||||
Volume *volume = (Volume *)_ns;
|
||||
Inode *inode = (Inode *)_node;
|
||||
|
||||
// The "chkbfs" functionality uses this flag to prevent the space used
|
||||
// up by the inode from being freed - this flag is set only in situations
|
||||
// where this is a good idea... (the block bitmap will get fixed anyway
|
||||
// in this case).
|
||||
if (inode->Flags() & INODE_DONT_FREE_SPACE)
|
||||
return B_OK;
|
||||
|
||||
// If the inode isn't in use anymore, we were called before
|
||||
// bfs_unlink() returns - in this case, we can just use the
|
||||
// transaction which has already deleted the inode.
|
||||
@ -577,6 +585,37 @@ bfs_ioctl(void *_ns, void *_node, void *_cookie, int cmd, void *buffer, size_t b
|
||||
inode->Node()->flags |= INODE_NO_CACHE;
|
||||
return status;
|
||||
}
|
||||
case BFS_IOCTL_VERSION:
|
||||
{
|
||||
uint32 *version = (uint32 *)buffer;
|
||||
|
||||
*version = 0x10000;
|
||||
return B_OK;
|
||||
}
|
||||
case BFS_IOCTL_START_CHECKING:
|
||||
{
|
||||
// start checking
|
||||
BlockAllocator &allocator = volume->Allocator();
|
||||
check_control *control = (check_control *)buffer;
|
||||
|
||||
return allocator.StartChecking(control);
|
||||
}
|
||||
case BFS_IOCTL_STOP_CHECKING:
|
||||
{
|
||||
// stop checking
|
||||
BlockAllocator &allocator = volume->Allocator();
|
||||
check_control *control = (check_control *)buffer;
|
||||
|
||||
return allocator.StopChecking(control);
|
||||
}
|
||||
case BFS_IOCTL_CHECK_NEXT_NODE:
|
||||
{
|
||||
// check next
|
||||
BlockAllocator &allocator = volume->Allocator();
|
||||
check_control *control = (check_control *)buffer;
|
||||
|
||||
return allocator.CheckNextNode(control);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
case 56742:
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user