2015-12-10 00:18:44 +00:00
|
|
|
/**
|
|
|
|
* segment.c
|
|
|
|
*
|
|
|
|
* Many parts of codes are copied from Linux kernel/fs/f2fs.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Huawei Ltd.
|
|
|
|
* Witten by:
|
|
|
|
* Hou Pengyang <houpengyang@huawei.com>
|
|
|
|
* Liu Shuoran <liushuoran@huawei.com>
|
|
|
|
* Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
#include "fsck.h"
|
|
|
|
#include "node.h"
|
|
|
|
|
2019-04-15 09:14:38 +00:00
|
|
|
int reserve_new_block(struct f2fs_sb_info *sbi, block_t *to,
|
2019-08-05 09:44:06 +00:00
|
|
|
struct f2fs_summary *sum, int type, bool is_inode)
|
2015-12-10 00:18:44 +00:00
|
|
|
{
|
2017-10-30 23:21:09 +00:00
|
|
|
struct f2fs_fsck *fsck = F2FS_FSCK(sbi);
|
2015-12-10 00:18:44 +00:00
|
|
|
struct seg_entry *se;
|
2017-10-30 23:21:09 +00:00
|
|
|
u64 blkaddr, offset;
|
|
|
|
u64 old_blkaddr = *to;
|
2019-08-05 09:44:06 +00:00
|
|
|
bool is_node = IS_NODESEG(type);
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2019-04-15 09:14:38 +00:00
|
|
|
if (old_blkaddr == NULL_ADDR) {
|
|
|
|
if (c.func == FSCK) {
|
|
|
|
if (fsck->chk.valid_blk_cnt >= sbi->user_block_count) {
|
2019-08-09 10:53:02 +00:00
|
|
|
ERR_MSG("Not enough space\n");
|
2019-04-15 09:14:38 +00:00
|
|
|
return -ENOSPC;
|
|
|
|
}
|
2019-08-05 09:44:06 +00:00
|
|
|
if (is_node && fsck->chk.valid_node_cnt >=
|
|
|
|
sbi->total_valid_node_count) {
|
2019-08-09 10:53:02 +00:00
|
|
|
ERR_MSG("Not enough space for node block\n");
|
2019-08-05 09:44:06 +00:00
|
|
|
return -ENOSPC;
|
|
|
|
}
|
2019-04-15 09:14:38 +00:00
|
|
|
} else {
|
|
|
|
if (sbi->total_valid_block_count >=
|
|
|
|
sbi->user_block_count) {
|
2019-08-09 10:53:02 +00:00
|
|
|
ERR_MSG("Not enough space\n");
|
2019-04-15 09:14:38 +00:00
|
|
|
return -ENOSPC;
|
|
|
|
}
|
2019-08-05 09:44:06 +00:00
|
|
|
if (is_node && sbi->total_valid_node_count >=
|
|
|
|
sbi->total_node_count) {
|
2019-08-09 10:53:02 +00:00
|
|
|
ERR_MSG("Not enough space for node block\n");
|
2019-08-05 09:44:06 +00:00
|
|
|
return -ENOSPC;
|
|
|
|
}
|
2019-04-15 09:14:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-10 00:18:44 +00:00
|
|
|
blkaddr = SM_I(sbi)->main_blkaddr;
|
|
|
|
|
2019-11-28 07:59:26 +00:00
|
|
|
if (find_next_free_block(sbi, &blkaddr, 0, type, false)) {
|
2019-04-15 09:14:38 +00:00
|
|
|
ERR_MSG("Can't find free block");
|
2015-12-10 00:18:44 +00:00
|
|
|
ASSERT(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
se = get_seg_entry(sbi, GET_SEGNO(sbi, blkaddr));
|
|
|
|
offset = OFFSET_IN_SEG(sbi, blkaddr);
|
|
|
|
se->type = type;
|
|
|
|
se->valid_blocks++;
|
|
|
|
f2fs_set_bit(offset, (char *)se->cur_valid_map);
|
f2fs-tools: fix to skip block allocation for fsynced data
Previously, we don't allow block allocation on unclean umounted image,
result in failing to repair quota system file.
In this patch, we port most recovery codes from kernel to userspace
tools, so that on unclean image, during fsck initialization, we will
record all data/node block address we may recover in kernel, and
then during allocation of quota file repair, we can skip those blocks
to avoid block use conflict.
Eventually, if free space is enough, we can repair the quota system
file on an unclean umounted image.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
[Jaegeuk Kim: remove unnecessary parameter]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-08-14 08:48:55 +00:00
|
|
|
if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG)) {
|
|
|
|
se->ckpt_type = type;
|
|
|
|
se->ckpt_valid_blocks++;
|
|
|
|
f2fs_set_bit(offset, (char *)se->ckpt_valid_map);
|
|
|
|
}
|
2017-10-30 23:21:09 +00:00
|
|
|
if (c.func == FSCK) {
|
|
|
|
f2fs_set_main_bitmap(sbi, blkaddr, type);
|
|
|
|
f2fs_set_sit_bitmap(sbi, blkaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (old_blkaddr == NULL_ADDR) {
|
|
|
|
sbi->total_valid_block_count++;
|
2019-08-05 09:44:06 +00:00
|
|
|
if (is_node) {
|
|
|
|
sbi->total_valid_node_count++;
|
|
|
|
if (is_inode)
|
|
|
|
sbi->total_valid_inode_count++;
|
|
|
|
}
|
2019-08-05 07:26:21 +00:00
|
|
|
if (c.func == FSCK) {
|
2017-10-30 23:21:09 +00:00
|
|
|
fsck->chk.valid_blk_cnt++;
|
2019-08-05 09:44:06 +00:00
|
|
|
if (is_node) {
|
2019-08-05 07:26:21 +00:00
|
|
|
fsck->chk.valid_node_cnt++;
|
2019-08-05 09:44:06 +00:00
|
|
|
if (is_inode)
|
|
|
|
fsck->chk.valid_inode_cnt++;
|
|
|
|
}
|
2019-08-05 07:26:21 +00:00
|
|
|
}
|
2017-10-30 23:21:09 +00:00
|
|
|
}
|
2015-12-10 00:18:44 +00:00
|
|
|
se->dirty = 1;
|
|
|
|
|
|
|
|
/* read/write SSA */
|
|
|
|
*to = (block_t)blkaddr;
|
|
|
|
update_sum_entry(sbi, *to, sum);
|
2019-04-15 09:14:38 +00:00
|
|
|
|
|
|
|
return 0;
|
2015-12-10 00:18:44 +00:00
|
|
|
}
|
|
|
|
|
2018-10-01 01:16:38 +00:00
|
|
|
int new_data_block(struct f2fs_sb_info *sbi, void *block,
|
2015-12-10 00:18:44 +00:00
|
|
|
struct dnode_of_data *dn, int type)
|
|
|
|
{
|
|
|
|
struct f2fs_summary sum;
|
|
|
|
struct node_info ni;
|
2017-11-02 17:41:16 +00:00
|
|
|
unsigned int blkaddr = datablock_addr(dn->node_blk, dn->ofs_in_node);
|
2019-04-15 09:14:38 +00:00
|
|
|
int ret;
|
2018-10-01 01:16:38 +00:00
|
|
|
|
2015-12-10 00:18:44 +00:00
|
|
|
ASSERT(dn->node_blk);
|
|
|
|
memset(block, 0, BLOCK_SZ);
|
|
|
|
|
|
|
|
get_node_info(sbi, dn->nid, &ni);
|
|
|
|
set_summary(&sum, dn->nid, dn->ofs_in_node, ni.version);
|
2019-08-05 09:44:06 +00:00
|
|
|
ret = reserve_new_block(sbi, &dn->data_blkaddr, &sum, type, 0);
|
2019-04-15 09:14:38 +00:00
|
|
|
if (ret) {
|
|
|
|
c.alloc_failed = 1;
|
|
|
|
return ret;
|
|
|
|
}
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-10-30 23:21:09 +00:00
|
|
|
if (blkaddr == NULL_ADDR)
|
|
|
|
inc_inode_blocks(dn);
|
|
|
|
else if (blkaddr == NEW_ADDR)
|
|
|
|
dn->idirty = 1;
|
2015-12-10 00:18:44 +00:00
|
|
|
set_data_blkaddr(dn);
|
2018-10-01 01:16:38 +00:00
|
|
|
return 0;
|
2015-12-10 00:18:44 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 17:41:16 +00:00
|
|
|
u64 f2fs_read(struct f2fs_sb_info *sbi, nid_t ino, u8 *buffer,
|
2015-12-10 00:18:44 +00:00
|
|
|
u64 count, pgoff_t offset)
|
|
|
|
{
|
2017-10-30 21:26:30 +00:00
|
|
|
struct dnode_of_data dn;
|
2015-12-10 00:18:44 +00:00
|
|
|
struct node_info ni;
|
|
|
|
struct f2fs_node *inode;
|
2017-10-30 21:26:30 +00:00
|
|
|
char *blk_buffer;
|
|
|
|
u64 filesize;
|
|
|
|
u64 off_in_blk;
|
|
|
|
u64 len_in_blk;
|
|
|
|
u64 read_count;
|
|
|
|
u64 remained_blkentries;
|
|
|
|
block_t blkaddr;
|
|
|
|
void *index_node = NULL;
|
|
|
|
|
|
|
|
memset(&dn, 0, sizeof(dn));
|
|
|
|
|
|
|
|
/* Memory allocation for block buffer and inode. */
|
|
|
|
blk_buffer = calloc(BLOCK_SZ, 2);
|
|
|
|
ASSERT(blk_buffer);
|
|
|
|
inode = (struct f2fs_node*)(blk_buffer + BLOCK_SZ);
|
|
|
|
|
|
|
|
/* Read inode */
|
2015-12-10 00:18:44 +00:00
|
|
|
get_node_info(sbi, ino, &ni);
|
2017-10-30 21:26:30 +00:00
|
|
|
ASSERT(dev_read_block(inode, ni.blk_addr) >= 0);
|
|
|
|
ASSERT(!S_ISDIR(le16_to_cpu(inode->i.i_mode)));
|
|
|
|
ASSERT(!S_ISLNK(le16_to_cpu(inode->i.i_mode)));
|
|
|
|
|
|
|
|
/* Adjust count with file length. */
|
|
|
|
filesize = le64_to_cpu(inode->i.i_size);
|
|
|
|
if (offset > filesize)
|
|
|
|
count = 0;
|
|
|
|
else if (count + offset > filesize)
|
|
|
|
count = filesize - offset;
|
|
|
|
|
|
|
|
/* Main loop for file blocks */
|
|
|
|
read_count = remained_blkentries = 0;
|
|
|
|
while (count > 0) {
|
|
|
|
if (remained_blkentries == 0) {
|
|
|
|
set_new_dnode(&dn, inode, NULL, ino);
|
|
|
|
get_dnode_of_data(sbi, &dn, F2FS_BYTES_TO_BLK(offset),
|
|
|
|
LOOKUP_NODE);
|
|
|
|
if (index_node)
|
|
|
|
free(index_node);
|
|
|
|
index_node = (dn.node_blk == dn.inode_blk) ?
|
|
|
|
NULL : dn.node_blk;
|
|
|
|
remained_blkentries = ADDRS_PER_PAGE(dn.node_blk);
|
|
|
|
}
|
|
|
|
ASSERT(remained_blkentries > 0);
|
|
|
|
|
|
|
|
blkaddr = datablock_addr(dn.node_blk, dn.ofs_in_node);
|
|
|
|
if (blkaddr == NULL_ADDR || blkaddr == NEW_ADDR)
|
|
|
|
break;
|
|
|
|
|
|
|
|
off_in_blk = offset % BLOCK_SZ;
|
|
|
|
len_in_blk = BLOCK_SZ - off_in_blk;
|
|
|
|
if (len_in_blk > count)
|
|
|
|
len_in_blk = count;
|
|
|
|
|
|
|
|
/* Read data from single block. */
|
|
|
|
if (len_in_blk < BLOCK_SZ) {
|
|
|
|
ASSERT(dev_read_block(blk_buffer, blkaddr) >= 0);
|
|
|
|
memcpy(buffer, blk_buffer + off_in_blk, len_in_blk);
|
|
|
|
} else {
|
|
|
|
/* Direct read */
|
|
|
|
ASSERT(dev_read_block(buffer, blkaddr) >= 0);
|
|
|
|
}
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-10-30 21:26:30 +00:00
|
|
|
offset += len_in_blk;
|
|
|
|
count -= len_in_blk;
|
|
|
|
buffer += len_in_blk;
|
|
|
|
read_count += len_in_blk;
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-10-30 21:26:30 +00:00
|
|
|
dn.ofs_in_node++;
|
|
|
|
remained_blkentries--;
|
|
|
|
}
|
|
|
|
if (index_node)
|
|
|
|
free(index_node);
|
|
|
|
free(blk_buffer);
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-10-30 21:26:30 +00:00
|
|
|
return read_count;
|
|
|
|
}
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-11-02 17:41:16 +00:00
|
|
|
u64 f2fs_write(struct f2fs_sb_info *sbi, nid_t ino, u8 *buffer,
|
2017-10-30 21:26:30 +00:00
|
|
|
u64 count, pgoff_t offset)
|
|
|
|
{
|
|
|
|
struct dnode_of_data dn;
|
|
|
|
struct node_info ni;
|
|
|
|
struct f2fs_node *inode;
|
|
|
|
char *blk_buffer;
|
|
|
|
u64 off_in_blk;
|
|
|
|
u64 len_in_blk;
|
|
|
|
u64 written_count;
|
|
|
|
u64 remained_blkentries;
|
|
|
|
block_t blkaddr;
|
|
|
|
void* index_node = NULL;
|
|
|
|
int idirty = 0;
|
2018-10-01 01:16:38 +00:00
|
|
|
int err;
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-10-30 21:26:30 +00:00
|
|
|
/* Memory allocation for block buffer and inode. */
|
|
|
|
blk_buffer = calloc(BLOCK_SZ, 2);
|
|
|
|
ASSERT(blk_buffer);
|
|
|
|
inode = (struct f2fs_node*)(blk_buffer + BLOCK_SZ);
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-10-30 21:26:30 +00:00
|
|
|
/* Read inode */
|
|
|
|
get_node_info(sbi, ino, &ni);
|
|
|
|
ASSERT(dev_read_block(inode, ni.blk_addr) >= 0);
|
|
|
|
ASSERT(!S_ISDIR(le16_to_cpu(inode->i.i_mode)));
|
|
|
|
ASSERT(!S_ISLNK(le16_to_cpu(inode->i.i_mode)));
|
|
|
|
|
|
|
|
/* Main loop for file blocks */
|
|
|
|
written_count = remained_blkentries = 0;
|
|
|
|
while (count > 0) {
|
|
|
|
if (remained_blkentries == 0) {
|
|
|
|
set_new_dnode(&dn, inode, NULL, ino);
|
2018-10-01 01:16:38 +00:00
|
|
|
err = get_dnode_of_data(sbi, &dn,
|
|
|
|
F2FS_BYTES_TO_BLK(offset), ALLOC_NODE);
|
|
|
|
if (err)
|
|
|
|
break;
|
2017-10-30 21:26:30 +00:00
|
|
|
idirty |= dn.idirty;
|
|
|
|
if (index_node)
|
|
|
|
free(index_node);
|
|
|
|
index_node = (dn.node_blk == dn.inode_blk) ?
|
|
|
|
NULL : dn.node_blk;
|
|
|
|
remained_blkentries = ADDRS_PER_PAGE(dn.node_blk);
|
|
|
|
}
|
|
|
|
ASSERT(remained_blkentries > 0);
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-10-30 21:26:30 +00:00
|
|
|
blkaddr = datablock_addr(dn.node_blk, dn.ofs_in_node);
|
|
|
|
if (blkaddr == NULL_ADDR || blkaddr == NEW_ADDR) {
|
2018-10-01 01:16:38 +00:00
|
|
|
err = new_data_block(sbi, blk_buffer,
|
|
|
|
&dn, CURSEG_WARM_DATA);
|
|
|
|
if (err)
|
|
|
|
break;
|
2017-10-30 21:26:30 +00:00
|
|
|
blkaddr = dn.data_blkaddr;
|
|
|
|
}
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-10-30 21:26:30 +00:00
|
|
|
off_in_blk = offset % BLOCK_SZ;
|
|
|
|
len_in_blk = BLOCK_SZ - off_in_blk;
|
|
|
|
if (len_in_blk > count)
|
|
|
|
len_in_blk = count;
|
|
|
|
|
|
|
|
/* Write data to single block. */
|
|
|
|
if (len_in_blk < BLOCK_SZ) {
|
|
|
|
ASSERT(dev_read_block(blk_buffer, blkaddr) >= 0);
|
|
|
|
memcpy(blk_buffer + off_in_blk, buffer, len_in_blk);
|
|
|
|
ASSERT(dev_write_block(blk_buffer, blkaddr) >= 0);
|
|
|
|
} else {
|
|
|
|
/* Direct write */
|
|
|
|
ASSERT(dev_write_block(buffer, blkaddr) >= 0);
|
|
|
|
}
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-10-30 21:26:30 +00:00
|
|
|
offset += len_in_blk;
|
|
|
|
count -= len_in_blk;
|
|
|
|
buffer += len_in_blk;
|
|
|
|
written_count += len_in_blk;
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2017-10-30 21:26:30 +00:00
|
|
|
dn.ofs_in_node++;
|
|
|
|
if ((--remained_blkentries == 0 || count == 0) && (dn.ndirty))
|
|
|
|
ASSERT(dev_write_block(dn.node_blk, dn.node_blkaddr) >= 0);
|
2015-12-10 00:18:44 +00:00
|
|
|
}
|
2017-10-30 21:26:30 +00:00
|
|
|
if (offset > le64_to_cpu(inode->i.i_size)) {
|
|
|
|
inode->i.i_size = cpu_to_le64(offset);
|
2017-10-30 19:12:39 +00:00
|
|
|
idirty = 1;
|
2015-12-10 00:18:44 +00:00
|
|
|
}
|
2017-10-30 19:12:39 +00:00
|
|
|
if (idirty) {
|
2015-12-10 00:18:44 +00:00
|
|
|
ASSERT(inode == dn.inode_blk);
|
2019-05-24 07:28:11 +00:00
|
|
|
ASSERT(write_inode(inode, ni.blk_addr) >= 0);
|
2015-12-10 00:18:44 +00:00
|
|
|
}
|
2017-10-30 21:26:30 +00:00
|
|
|
if (index_node)
|
|
|
|
free(index_node);
|
|
|
|
free(blk_buffer);
|
|
|
|
|
|
|
|
return written_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function updates only inode->i.i_size */
|
|
|
|
void f2fs_filesize_update(struct f2fs_sb_info *sbi, nid_t ino, u64 filesize)
|
|
|
|
{
|
|
|
|
struct node_info ni;
|
|
|
|
struct f2fs_node *inode;
|
|
|
|
|
|
|
|
inode = calloc(BLOCK_SZ, 1);
|
|
|
|
ASSERT(inode);
|
|
|
|
get_node_info(sbi, ino, &ni);
|
|
|
|
|
|
|
|
ASSERT(dev_read_block(inode, ni.blk_addr) >= 0);
|
|
|
|
ASSERT(!S_ISDIR(le16_to_cpu(inode->i.i_mode)));
|
|
|
|
ASSERT(!S_ISLNK(le16_to_cpu(inode->i.i_mode)));
|
|
|
|
|
|
|
|
inode->i.i_size = cpu_to_le64(filesize);
|
2015-12-10 00:18:44 +00:00
|
|
|
|
2019-05-24 07:28:11 +00:00
|
|
|
ASSERT(write_inode(inode, ni.blk_addr) >= 0);
|
2015-12-10 00:18:44 +00:00
|
|
|
free(inode);
|
|
|
|
}
|
|
|
|
|
|
|
|
int f2fs_build_file(struct f2fs_sb_info *sbi, struct dentry *de)
|
|
|
|
{
|
|
|
|
int fd, n;
|
|
|
|
pgoff_t off = 0;
|
2017-11-02 17:41:16 +00:00
|
|
|
u8 buffer[BLOCK_SZ];
|
2015-12-10 00:18:44 +00:00
|
|
|
|
|
|
|
if (de->ino == 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
fd = open(de->full_path, O_RDONLY);
|
|
|
|
if (fd < 0) {
|
|
|
|
MSG(0, "Skip: Fail to open %s\n", de->full_path);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* inline_data support */
|
2017-07-26 14:49:57 +00:00
|
|
|
if (de->size <= DEF_MAX_INLINE_DATA) {
|
2015-12-10 00:18:44 +00:00
|
|
|
struct node_info ni;
|
|
|
|
struct f2fs_node *node_blk;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
get_node_info(sbi, de->ino, &ni);
|
|
|
|
|
|
|
|
node_blk = calloc(BLOCK_SZ, 1);
|
|
|
|
ASSERT(node_blk);
|
|
|
|
|
|
|
|
ret = dev_read_block(node_blk, ni.blk_addr);
|
|
|
|
ASSERT(ret >= 0);
|
|
|
|
|
|
|
|
node_blk->i.i_inline |= F2FS_INLINE_DATA;
|
|
|
|
node_blk->i.i_inline |= F2FS_DATA_EXIST;
|
2017-07-26 14:49:57 +00:00
|
|
|
|
|
|
|
if (c.feature & cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR)) {
|
|
|
|
node_blk->i.i_inline |= F2FS_EXTRA_ATTR;
|
|
|
|
node_blk->i.i_extra_isize =
|
2019-04-28 09:17:37 +00:00
|
|
|
cpu_to_le16(calc_extra_isize());
|
2017-07-26 14:49:57 +00:00
|
|
|
}
|
2015-12-10 00:18:44 +00:00
|
|
|
n = read(fd, buffer, BLOCK_SZ);
|
2017-11-02 17:41:16 +00:00
|
|
|
ASSERT((unsigned long)n == de->size);
|
2017-07-26 14:49:57 +00:00
|
|
|
memcpy(inline_data_addr(node_blk), buffer, de->size);
|
2015-12-10 00:18:44 +00:00
|
|
|
node_blk->i.i_size = cpu_to_le64(de->size);
|
2019-05-24 07:28:11 +00:00
|
|
|
ASSERT(write_inode(node_blk, ni.blk_addr) >= 0);
|
2015-12-10 00:18:44 +00:00
|
|
|
free(node_blk);
|
|
|
|
} else {
|
|
|
|
while ((n = read(fd, buffer, BLOCK_SZ)) > 0) {
|
2017-10-30 21:26:30 +00:00
|
|
|
f2fs_write(sbi, de->ino, buffer, n, off);
|
2015-12-10 00:18:44 +00:00
|
|
|
off += n;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
close(fd);
|
|
|
|
if (n < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
update_free_segments(sbi);
|
|
|
|
|
2017-11-30 01:21:12 +00:00
|
|
|
MSG(1, "Info: Create %s -> %s\n"
|
|
|
|
" -- ino=%x, type=%x, mode=%x, uid=%x, "
|
|
|
|
"gid=%x, cap=%"PRIx64", size=%lu, pino=%x\n",
|
|
|
|
de->full_path, de->path,
|
|
|
|
de->ino, de->file_type, de->mode,
|
|
|
|
de->uid, de->gid, de->capabilities, de->size, de->pino);
|
2015-12-10 00:18:44 +00:00
|
|
|
return 0;
|
|
|
|
}
|