Added a comment about live-queries in Inode::Create().
Some style cleanups. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2060 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -386,7 +386,8 @@ Inode::RemoveSmallData(Transaction *transaction,const char *name)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Inode::AddSmallData(Transaction *transaction,const char *name,uint32 type,const uint8 *data,size_t length,bool force)
|
Inode::AddSmallData(Transaction *transaction, const char *name, uint32 type,
|
||||||
|
const uint8 *data, size_t length, bool force)
|
||||||
{
|
{
|
||||||
if (name == NULL || data == NULL || type == 0)
|
if (name == NULL || data == NULL || type == 0)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -650,7 +651,8 @@ Inode::ReadAttribute(const char *name, int32 type, off_t pos, uint8 *buffer, siz
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Inode::WriteAttribute(Transaction *transaction,const char *name,int32 type,off_t pos,const uint8 *buffer,size_t *_length)
|
Inode::WriteAttribute(Transaction *transaction, const char *name, int32 type, off_t pos,
|
||||||
|
const uint8 *buffer, size_t *_length)
|
||||||
{
|
{
|
||||||
// needed to maintain the index
|
// needed to maintain the index
|
||||||
uint8 oldBuffer[BPLUSTREE_MAX_KEY_LENGTH], *oldData = NULL;
|
uint8 oldBuffer[BPLUSTREE_MAX_KEY_LENGTH], *oldData = NULL;
|
||||||
@@ -1370,7 +1372,8 @@ Inode::GrowStream(Transaction *transaction, off_t size)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Inode::FreeStaticStreamArray(Transaction *transaction,int32 level,block_run run,off_t size,off_t offset,off_t &max)
|
Inode::FreeStaticStreamArray(Transaction *transaction, int32 level, block_run run,
|
||||||
|
off_t size, off_t offset, off_t &max)
|
||||||
{
|
{
|
||||||
int32 indirectSize;
|
int32 indirectSize;
|
||||||
if (level == 0)
|
if (level == 0)
|
||||||
@@ -1438,7 +1441,8 @@ Inode::FreeStaticStreamArray(Transaction *transaction,int32 level,block_run run,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Inode::FreeStreamArray(Transaction *transaction,block_run *array,uint32 arrayLength,off_t size,off_t &offset,off_t &max)
|
Inode::FreeStreamArray(Transaction *transaction, block_run *array, uint32 arrayLength,
|
||||||
|
off_t size, off_t &offset, off_t &max)
|
||||||
{
|
{
|
||||||
off_t newOffset = offset;
|
off_t newOffset = offset;
|
||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
@@ -1485,7 +1489,8 @@ Inode::ShrinkStream(Transaction *transaction, off_t size)
|
|||||||
data_stream *data = &Node()->data;
|
data_stream *data = &Node()->data;
|
||||||
|
|
||||||
if (data->max_double_indirect_range > size) {
|
if (data->max_double_indirect_range > size) {
|
||||||
FreeStaticStreamArray(transaction,0,data->double_indirect,size,data->max_indirect_range,data->max_double_indirect_range);
|
FreeStaticStreamArray(transaction, 0, data->double_indirect, size,
|
||||||
|
data->max_indirect_range, data->max_double_indirect_range);
|
||||||
|
|
||||||
if (size <= data->max_indirect_range) {
|
if (size <= data->max_indirect_range) {
|
||||||
fVolume->Free(transaction, data->double_indirect);
|
fVolume->Free(transaction, data->double_indirect);
|
||||||
@@ -1503,7 +1508,8 @@ Inode::ShrinkStream(Transaction *transaction, off_t size)
|
|||||||
if (array == NULL)
|
if (array == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (FreeStreamArray(transaction,array,fVolume->BlockSize() / sizeof(block_run),size,offset,data->max_indirect_range) == B_OK)
|
if (FreeStreamArray(transaction, array, fVolume->BlockSize() / sizeof(block_run),
|
||||||
|
size, offset, data->max_indirect_range) == B_OK)
|
||||||
cached.WriteBack(transaction);
|
cached.WriteBack(transaction);
|
||||||
}
|
}
|
||||||
if (data->max_direct_range == data->max_indirect_range) {
|
if (data->max_direct_range == data->max_indirect_range) {
|
||||||
@@ -1514,7 +1520,8 @@ Inode::ShrinkStream(Transaction *transaction, off_t size)
|
|||||||
}
|
}
|
||||||
if (data->max_direct_range > size) {
|
if (data->max_direct_range > size) {
|
||||||
off_t offset = 0;
|
off_t offset = 0;
|
||||||
FreeStreamArray(transaction, data->direct, NUM_DIRECT_BLOCKS, size, offset, data->max_direct_range);
|
FreeStreamArray(transaction, data->direct, NUM_DIRECT_BLOCKS, size, offset,
|
||||||
|
data->max_direct_range);
|
||||||
}
|
}
|
||||||
|
|
||||||
data->size = size;
|
data->size = size;
|
||||||
@@ -1621,7 +1628,8 @@ Inode::Sync()
|
|||||||
if (data->direct[i].IsZero())
|
if (data->direct[i].IsZero())
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
status = flush_blocks(fVolume->Device(),fVolume->ToBlock(data->direct[i]),data->direct[i].length);
|
status = flush_blocks(fVolume->Device(), fVolume->ToBlock(data->direct[i]),
|
||||||
|
data->direct[i].length);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -1680,7 +1688,8 @@ Inode::Sync()
|
|||||||
|
|
||||||
// ToDo: combine single block_runs to bigger ones when
|
// ToDo: combine single block_runs to bigger ones when
|
||||||
// they are adjacent
|
// they are adjacent
|
||||||
status = flush_blocks(fVolume->Device(),fVolume->ToBlock(runs[i]),runs[i].length);
|
status = flush_blocks(fVolume->Device(), fVolume->ToBlock(runs[i]),
|
||||||
|
runs[i].length);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -1893,7 +1902,8 @@ Inode::Create(Transaction *transaction, Inode *parent, const char *name, int32 m
|
|||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
RETURN_ERROR(status);
|
RETURN_ERROR(status);
|
||||||
|
|
||||||
// update the main indices (name, size & last_modified)
|
// Update the main indices (name, size & last_modified)
|
||||||
|
// (live queries might want to access us after this)
|
||||||
|
|
||||||
Index index(volume);
|
Index index(volume);
|
||||||
if (inode->IsRegularNode()) {
|
if (inode->IsRegularNode()) {
|
||||||
@@ -2033,7 +2043,8 @@ AttributeIterator::GetNext(char *name, size_t *_length, uint32 *_type, vnode_id
|
|||||||
|
|
||||||
// if you haven't yet access to the attributes directory, get it
|
// if you haven't yet access to the attributes directory, get it
|
||||||
if (fAttributes == NULL) {
|
if (fAttributes == NULL) {
|
||||||
if (get_vnode(volume->ID(),volume->ToVnode(fInode->Attributes()),(void **)&fAttributes) != 0
|
if (get_vnode(volume->ID(), volume->ToVnode(fInode->Attributes()),
|
||||||
|
(void **)&fAttributes) != 0
|
||||||
|| fAttributes == NULL) {
|
|| fAttributes == NULL) {
|
||||||
FATAL(("get_vnode() failed in AttributeIterator::GetNext(vnode_id = %Ld,name = \"%s\")\n",fInode->ID(),name));
|
FATAL(("get_vnode() failed in AttributeIterator::GetNext(vnode_id = %Ld,name = \"%s\")\n",fInode->ID(),name));
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
|||||||
Reference in New Issue
Block a user