Changeset View
Changeset View
Standalone View
Standalone View
head/sys/fs/ext2fs/ext2_htree.c
Show All 34 Lines | |||||
#include <sys/namei.h> | #include <sys/namei.h> | ||||
#include <sys/bio.h> | #include <sys/bio.h> | ||||
#include <sys/buf.h> | #include <sys/buf.h> | ||||
#include <sys/endian.h> | #include <sys/endian.h> | ||||
#include <sys/mount.h> | #include <sys/mount.h> | ||||
#include <sys/vnode.h> | #include <sys/vnode.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/dirent.h> | #include <sys/dirent.h> | ||||
#include <sys/sdt.h> | |||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <ufs/ufs/dir.h> | #include <ufs/ufs/dir.h> | ||||
#include <fs/ext2fs/fs.h> | #include <fs/ext2fs/fs.h> | ||||
#include <fs/ext2fs/inode.h> | #include <fs/ext2fs/inode.h> | ||||
#include <fs/ext2fs/ext2_mount.h> | #include <fs/ext2fs/ext2_mount.h> | ||||
#include <fs/ext2fs/ext2fs.h> | #include <fs/ext2fs/ext2fs.h> | ||||
#include <fs/ext2fs/fs.h> | #include <fs/ext2fs/fs.h> | ||||
#include <fs/ext2fs/ext2_extern.h> | #include <fs/ext2fs/ext2_extern.h> | ||||
#include <fs/ext2fs/ext2_dinode.h> | #include <fs/ext2fs/ext2_dinode.h> | ||||
#include <fs/ext2fs/ext2_dir.h> | #include <fs/ext2fs/ext2_dir.h> | ||||
#include <fs/ext2fs/htree.h> | #include <fs/ext2fs/htree.h> | ||||
SDT_PROVIDER_DECLARE(ext2fs); | |||||
/* | |||||
* ext2fs trace probe: | |||||
* arg0: verbosity. Higher numbers give more verbose messages | |||||
* arg1: Textual message | |||||
*/ | |||||
SDT_PROBE_DEFINE2(ext2fs, , trace, htree, "int", "char*"); | |||||
static void ext2_append_entry(char *block, uint32_t blksize, | static void ext2_append_entry(char *block, uint32_t blksize, | ||||
struct ext2fs_direct_2 *last_entry, | struct ext2fs_direct_2 *last_entry, | ||||
struct ext2fs_direct_2 *new_entry, int csum_size); | struct ext2fs_direct_2 *new_entry, int csum_size); | ||||
static int ext2_htree_append_block(struct vnode *vp, char *data, | static int ext2_htree_append_block(struct vnode *vp, char *data, | ||||
struct componentname *cnp, uint32_t blksize); | struct componentname *cnp, uint32_t blksize); | ||||
static int ext2_htree_check_next(struct inode *ip, uint32_t hash, | static int ext2_htree_check_next(struct inode *ip, uint32_t hash, | ||||
const char *name, struct ext2fs_htree_lookup_info *info); | const char *name, struct ext2fs_htree_lookup_info *info); | ||||
static int ext2_htree_cmp_sort_entry(const void *e1, const void *e2); | static int ext2_htree_cmp_sort_entry(const void *e1, const void *e2); | ||||
▲ Show 20 Lines • Show All 746 Lines • ▼ Show 20 Lines | if (ent_num == ext2_htree_get_limit(entries)) { | ||||
dst_node = (struct ext2fs_htree_node *)dst_bp->b_data; | dst_node = (struct ext2fs_htree_node *)dst_bp->b_data; | ||||
dst_entries = dst_node->h_entries; | dst_entries = dst_node->h_entries; | ||||
if (info.h_levels_num == 2) { | if (info.h_levels_num == 2) { | ||||
uint16_t src_ent_num, dst_ent_num; | uint16_t src_ent_num, dst_ent_num; | ||||
if (ext2_htree_get_count(root_entires) == | if (ext2_htree_get_count(root_entires) == | ||||
ext2_htree_get_limit(root_entires)) { | ext2_htree_get_limit(root_entires)) { | ||||
/* Directory index is full */ | SDT_PROBE2(ext2fs, , trace, htree, 1, | ||||
"directory index is full"); | |||||
error = EIO; | error = EIO; | ||||
goto finish; | goto finish; | ||||
} | } | ||||
src_ent_num = ent_num / 2; | src_ent_num = ent_num / 2; | ||||
dst_ent_num = ent_num - src_ent_num; | dst_ent_num = ent_num - src_ent_num; | ||||
split_hash = ext2_htree_get_hash(entries + src_ent_num); | split_hash = ext2_htree_get_hash(entries + src_ent_num); | ||||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |