Skip to content

Commit

Permalink
afs: Increase to 64-bit volume ID and 96-bit vnode ID for YFS
Browse files Browse the repository at this point in the history
Increase the sizes of the volume ID to 64 bits and the vnode ID (inode
number equivalent) to 96 bits to allow the support of YFS.

This requires the iget comparator to check the vnode->fid rather than i_ino
and i_generation as i_ino is not sufficiently capacious.  It also requires
this data to be placed into the vnode cache key for fscache.

For the moment, just discard the top 32 bits of the vnode ID when returning
it though stat.

Signed-off-by: David Howells <[email protected]>
  • Loading branch information
dhowells committed Oct 23, 2018
1 parent 2a0b4f6 commit 3b6492d
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 81 deletions.
11 changes: 6 additions & 5 deletions fs/afs/afs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#define AFSPATHMAX 1024 /* Maximum length of a pathname plus NUL */
#define AFSOPAQUEMAX 1024 /* Maximum length of an opaque field */

typedef unsigned afs_volid_t;
typedef unsigned afs_vnodeid_t;
typedef unsigned long long afs_dataversion_t;
typedef u64 afs_volid_t;
typedef u64 afs_vnodeid_t;
typedef u64 afs_dataversion_t;

typedef enum {
AFSVL_RWVOL, /* read/write volume */
Expand All @@ -52,8 +52,9 @@ typedef enum {
*/
struct afs_fid {
afs_volid_t vid; /* volume ID */
afs_vnodeid_t vnode; /* file index within volume */
unsigned unique; /* unique ID number (file index version) */
afs_vnodeid_t vnode; /* Lower 64-bits of file index within volume */
u32 vnode_hi; /* Upper 32-bits of file index */
u32 unique; /* unique ID number (file index version) */
};

/*
Expand Down
2 changes: 1 addition & 1 deletion fs/afs/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static enum fscache_checkaux afs_vnode_cache_check_aux(void *cookie_netfs_data,
struct afs_vnode *vnode = cookie_netfs_data;
struct afs_vnode_cache_aux aux;

_enter("{%x,%x,%llx},%p,%u",
_enter("{%llx,%x,%llx},%p,%u",
vnode->fid.vnode, vnode->fid.unique, vnode->status.data_version,
buffer, buflen);

Expand Down
2 changes: 1 addition & 1 deletion fs/afs/callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void afs_break_callbacks(struct afs_server *server, size_t count,
/* TODO: Sort the callback break list by volume ID */

for (; count > 0; callbacks++, count--) {
_debug("- Fid { vl=%08x n=%u u=%u } CB { v=%u x=%u t=%u }",
_debug("- Fid { vl=%08llx n=%llu u=%u } CB { v=%u x=%u t=%u }",
callbacks->fid.vid,
callbacks->fid.vnode,
callbacks->fid.unique,
Expand Down
24 changes: 12 additions & 12 deletions fs/afs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ static int afs_do_lookup_one(struct inode *dir, struct dentry *dentry,
}

*fid = cookie.fid;
_leave(" = 0 { vn=%u u=%u }", fid->vnode, fid->unique);
_leave(" = 0 { vn=%llu u=%u }", fid->vnode, fid->unique);
return 0;
}

Expand Down Expand Up @@ -830,7 +830,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
struct key *key;
int ret;

_enter("{%x:%u},%p{%pd},",
_enter("{%llx:%llu},%p{%pd},",
dvnode->fid.vid, dvnode->fid.vnode, dentry, dentry);

ASSERTCMP(d_inode(dentry), ==, NULL);
Expand Down Expand Up @@ -900,7 +900,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)

if (d_really_is_positive(dentry)) {
vnode = AFS_FS_I(d_inode(dentry));
_enter("{v={%x:%u} n=%pd fl=%lx},",
_enter("{v={%llx:%llu} n=%pd fl=%lx},",
vnode->fid.vid, vnode->fid.vnode, dentry,
vnode->flags);
} else {
Expand Down Expand Up @@ -969,7 +969,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
/* if the vnode ID has changed, then the dirent points to a
* different file */
if (fid.vnode != vnode->fid.vnode) {
_debug("%pd: dirent changed [%u != %u]",
_debug("%pd: dirent changed [%llu != %llu]",
dentry, fid.vnode,
vnode->fid.vnode);
goto not_found;
Expand Down Expand Up @@ -1108,7 +1108,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)

mode |= S_IFDIR;

_enter("{%x:%u},{%pd},%ho",
_enter("{%llx:%llu},{%pd},%ho",
dvnode->fid.vid, dvnode->fid.vnode, dentry, mode);

key = afs_request_key(dvnode->volume->cell);
Expand Down Expand Up @@ -1178,7 +1178,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
u64 data_version = dvnode->status.data_version;
int ret;

_enter("{%x:%u},{%pd}",
_enter("{%llx:%llu},{%pd}",
dvnode->fid.vid, dvnode->fid.vnode, dentry);

key = afs_request_key(dvnode->volume->cell);
Expand Down Expand Up @@ -1270,7 +1270,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
u64 data_version = dvnode->status.data_version;
int ret;

_enter("{%x:%u},{%pd}",
_enter("{%llx:%llu},{%pd}",
dvnode->fid.vid, dvnode->fid.vnode, dentry);

if (dentry->d_name.len >= AFSNAMEMAX)
Expand Down Expand Up @@ -1334,7 +1334,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,

mode |= S_IFREG;

_enter("{%x:%u},{%pd},%ho,",
_enter("{%llx:%llu},{%pd},%ho,",
dvnode->fid.vid, dvnode->fid.vnode, dentry, mode);

ret = -ENAMETOOLONG;
Expand Down Expand Up @@ -1397,7 +1397,7 @@ static int afs_link(struct dentry *from, struct inode *dir,
dvnode = AFS_FS_I(dir);
data_version = dvnode->status.data_version;

_enter("{%x:%u},{%x:%u},{%pd}",
_enter("{%llx:%llu},{%llx:%llu},{%pd}",
vnode->fid.vid, vnode->fid.vnode,
dvnode->fid.vid, dvnode->fid.vnode,
dentry);
Expand Down Expand Up @@ -1468,7 +1468,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
u64 data_version = dvnode->status.data_version;
int ret;

_enter("{%x:%u},{%pd},%s",
_enter("{%llx:%llu},{%pd},%s",
dvnode->fid.vid, dvnode->fid.vnode, dentry,
content);

Expand Down Expand Up @@ -1544,7 +1544,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
orig_data_version = orig_dvnode->status.data_version;
new_data_version = new_dvnode->status.data_version;

_enter("{%x:%u},{%x:%u},{%x:%u},{%pd}",
_enter("{%llx:%llu},{%llx:%llu},{%llx:%llu},{%pd}",
orig_dvnode->fid.vid, orig_dvnode->fid.vnode,
vnode->fid.vid, vnode->fid.vnode,
new_dvnode->fid.vid, new_dvnode->fid.vnode,
Expand Down Expand Up @@ -1611,7 +1611,7 @@ static int afs_dir_releasepage(struct page *page, gfp_t gfp_flags)
{
struct afs_vnode *dvnode = AFS_FS_I(page->mapping->host);

_enter("{{%x:%u}[%lu]}", dvnode->fid.vid, dvnode->fid.vnode, page->index);
_enter("{{%llx:%llu}[%lu]}", dvnode->fid.vid, dvnode->fid.vnode, page->index);

set_page_private(page, 0);
ClearPagePrivate(page);
Expand Down
2 changes: 1 addition & 1 deletion fs/afs/dynroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct inode *afs_try_auto_mntpt(struct dentry *dentry, struct inode *dir)
struct inode *inode;
int ret = -ENOENT;

_enter("%p{%pd}, {%x:%u}",
_enter("%p{%pd}, {%llx:%llu}",
dentry, dentry, vnode->fid.vid, vnode->fid.vnode);

if (!test_bit(AFS_VNODE_AUTOCELL, &vnode->flags))
Expand Down
8 changes: 4 additions & 4 deletions fs/afs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ int afs_open(struct inode *inode, struct file *file)
struct key *key;
int ret;

_enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
_enter("{%llx:%llu},", vnode->fid.vid, vnode->fid.vnode);

key = afs_request_key(vnode->volume->cell);
if (IS_ERR(key)) {
Expand Down Expand Up @@ -170,7 +170,7 @@ int afs_release(struct inode *inode, struct file *file)
struct afs_vnode *vnode = AFS_FS_I(inode);
struct afs_file *af = file->private_data;

_enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
_enter("{%llx:%llu},", vnode->fid.vid, vnode->fid.vnode);

if ((file->f_mode & FMODE_WRITE))
return vfs_fsync(file, 0);
Expand Down Expand Up @@ -228,7 +228,7 @@ int afs_fetch_data(struct afs_vnode *vnode, struct key *key, struct afs_read *de
struct afs_fs_cursor fc;
int ret;

_enter("%s{%x:%u.%u},%x,,,",
_enter("%s{%llx:%llu.%u},%x,,,",
vnode->volume->name,
vnode->fid.vid,
vnode->fid.vnode,
Expand Down Expand Up @@ -634,7 +634,7 @@ static int afs_releasepage(struct page *page, gfp_t gfp_flags)
struct afs_vnode *vnode = AFS_FS_I(page->mapping->host);
unsigned long priv;

_enter("{{%x:%u}[%lu],%lx},%x",
_enter("{{%llx:%llu}[%lu],%lx},%x",
vnode->fid.vid, vnode->fid.vnode, page->index, page->flags,
gfp_flags);

Expand Down
22 changes: 11 additions & 11 deletions fs/afs/flock.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static const struct file_lock_operations afs_lock_ops = {
*/
void afs_lock_may_be_available(struct afs_vnode *vnode)
{
_enter("{%x:%u}", vnode->fid.vid, vnode->fid.vnode);
_enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode);

queue_delayed_work(afs_lock_manager, &vnode->lock_work, 0);
}
Expand Down Expand Up @@ -76,7 +76,7 @@ static int afs_set_lock(struct afs_vnode *vnode, struct key *key,
struct afs_fs_cursor fc;
int ret;

_enter("%s{%x:%u.%u},%x,%u",
_enter("%s{%llx:%llu.%u},%x,%u",
vnode->volume->name,
vnode->fid.vid,
vnode->fid.vnode,
Expand Down Expand Up @@ -107,7 +107,7 @@ static int afs_extend_lock(struct afs_vnode *vnode, struct key *key)
struct afs_fs_cursor fc;
int ret;

_enter("%s{%x:%u.%u},%x",
_enter("%s{%llx:%llu.%u},%x",
vnode->volume->name,
vnode->fid.vid,
vnode->fid.vnode,
Expand Down Expand Up @@ -138,7 +138,7 @@ static int afs_release_lock(struct afs_vnode *vnode, struct key *key)
struct afs_fs_cursor fc;
int ret;

_enter("%s{%x:%u.%u},%x",
_enter("%s{%llx:%llu.%u},%x",
vnode->volume->name,
vnode->fid.vid,
vnode->fid.vnode,
Expand Down Expand Up @@ -175,7 +175,7 @@ void afs_lock_work(struct work_struct *work)
struct key *key;
int ret;

_enter("{%x:%u}", vnode->fid.vid, vnode->fid.vnode);
_enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode);

spin_lock(&vnode->lock);

Expand All @@ -192,7 +192,7 @@ void afs_lock_work(struct work_struct *work)
ret = afs_release_lock(vnode, vnode->lock_key);
if (ret < 0)
printk(KERN_WARNING "AFS:"
" Failed to release lock on {%x:%x} error %d\n",
" Failed to release lock on {%llx:%llx} error %d\n",
vnode->fid.vid, vnode->fid.vnode, ret);

spin_lock(&vnode->lock);
Expand Down Expand Up @@ -229,7 +229,7 @@ void afs_lock_work(struct work_struct *work)
key_put(key);

if (ret < 0)
pr_warning("AFS: Failed to extend lock on {%x:%x} error %d\n",
pr_warning("AFS: Failed to extend lock on {%llx:%llx} error %d\n",
vnode->fid.vid, vnode->fid.vnode, ret);

spin_lock(&vnode->lock);
Expand Down Expand Up @@ -430,7 +430,7 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)
struct key *key = afs_file_key(file);
int ret;

_enter("{%x:%u},%u", vnode->fid.vid, vnode->fid.vnode, fl->fl_type);
_enter("{%llx:%llu},%u", vnode->fid.vid, vnode->fid.vnode, fl->fl_type);

/* only whole-file locks are supported */
if (fl->fl_start != 0 || fl->fl_end != OFFSET_MAX)
Expand Down Expand Up @@ -582,7 +582,7 @@ static int afs_do_unlk(struct file *file, struct file_lock *fl)
struct afs_vnode *vnode = AFS_FS_I(locks_inode(file));
int ret;

_enter("{%x:%u},%u", vnode->fid.vid, vnode->fid.vnode, fl->fl_type);
_enter("{%llx:%llu},%u", vnode->fid.vid, vnode->fid.vnode, fl->fl_type);

/* Flush all pending writes before doing anything with locks. */
vfs_fsync(file, 0);
Expand Down Expand Up @@ -639,7 +639,7 @@ int afs_lock(struct file *file, int cmd, struct file_lock *fl)
{
struct afs_vnode *vnode = AFS_FS_I(locks_inode(file));

_enter("{%x:%u},%d,{t=%x,fl=%x,r=%Ld:%Ld}",
_enter("{%llx:%llu},%d,{t=%x,fl=%x,r=%Ld:%Ld}",
vnode->fid.vid, vnode->fid.vnode, cmd,
fl->fl_type, fl->fl_flags,
(long long) fl->fl_start, (long long) fl->fl_end);
Expand All @@ -662,7 +662,7 @@ int afs_flock(struct file *file, int cmd, struct file_lock *fl)
{
struct afs_vnode *vnode = AFS_FS_I(locks_inode(file));

_enter("{%x:%u},%d,{t=%x,fl=%x}",
_enter("{%llx:%llu},%d,{t=%x,fl=%x}",
vnode->fid.vid, vnode->fid.vnode, cmd,
fl->fl_type, fl->fl_flags);

Expand Down
Loading

0 comments on commit 3b6492d

Please sign in to comment.