mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-09 05:13:18 +00:00
Add printing link backref items
Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -265,6 +265,14 @@ struct scoutfs_readdir_key {
|
||||
__be64 pos;
|
||||
} __packed;
|
||||
|
||||
/* value is empty */
|
||||
struct scoutfs_link_backref_key {
|
||||
__u8 type;
|
||||
__be64 ino;
|
||||
__be64 dir_ino;
|
||||
__u8 name[0];
|
||||
} __packed;
|
||||
|
||||
/* no value */
|
||||
struct scoutfs_orphan_key {
|
||||
__u8 type;
|
||||
@@ -479,17 +487,8 @@ struct scoutfs_extent {
|
||||
|
||||
#define SCOUTFS_EXTENT_FLAG_OFFLINE (1 << 0)
|
||||
|
||||
/*
|
||||
* link backrefs give us a way to find all the hard links that refer
|
||||
* to a target inode. They're stored at an offset determined by an
|
||||
* advancing counter in their inode.
|
||||
*/
|
||||
struct scoutfs_link_backref {
|
||||
__le64 ino;
|
||||
__le64 offset;
|
||||
} __packed;
|
||||
|
||||
/* ino_path can search for backref items with a null term */
|
||||
#define SCOUTFS_MAX_KEY_SIZE \
|
||||
offsetof(struct scoutfs_dirent_key, name[SCOUTFS_NAME_LEN])
|
||||
offsetof(struct scoutfs_link_backref_key, name[SCOUTFS_NAME_LEN + 1])
|
||||
|
||||
#endif
|
||||
|
||||
@@ -179,14 +179,17 @@ static void print_data(void *key, int key_len, void *val, int val_len)
|
||||
be64_to_cpu(dat->ino), be64_to_cpu(dat->block));
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void print_link_backref(struct scoutfs_link_backref *lref,
|
||||
unsigned int val_len)
|
||||
static void print_link_backref(void *key, int key_len, void *val, int val_len)
|
||||
{
|
||||
printf(" lref: ino: %llu offset: %llu\n",
|
||||
le64_to_cpu(lref->ino), le64_to_cpu(lref->offset));
|
||||
struct scoutfs_link_backref_key *lbkey = key;
|
||||
unsigned int name_len = key_len - sizeof(*lbkey);
|
||||
u8 *name = global_printable_name(lbkey->name, name_len);
|
||||
|
||||
printf(" lbref: ino: %llu dir_ino %llu name %s\n",
|
||||
be64_to_cpu(lbkey->ino), be64_to_cpu(lbkey->dir_ino), name);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* for now show the raw component items not the whole path */
|
||||
static void print_symlink(char *str, unsigned int val_len)
|
||||
{
|
||||
@@ -213,6 +216,7 @@ static print_func_t printers[] = {
|
||||
[SCOUTFS_ORPHAN_KEY] = print_orphan,
|
||||
[SCOUTFS_DIRENT_KEY] = print_dirent,
|
||||
[SCOUTFS_READDIR_KEY] = print_readdir,
|
||||
[SCOUTFS_LINK_BACKREF_KEY] = print_link_backref,
|
||||
[SCOUTFS_DATA_KEY] = print_data,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user