* vfs dmapi handle generation problem
@ 2008-06-04 13:55 Tim Jödicke
2008-06-04 15:16 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Tim Jödicke @ 2008-06-04 13:55 UTC (permalink / raw)
To: xfs
hi,
i have a question about the dmapi support for xfs. in detail, it's about
the method "xfs_dm_inode_to_fh()". i tried to swap out this function to
vfs code and this is what it looks like now:
int
vfs_dm_inode_to_fh(struct inode *ip, dm_fid_t *dmfid, dm_fsid_t *dmfsid)
{
dmfid->dm_fid_len = sizeof(dm_fid_t) - sizeof(dmfid->dm_fid_len);
dmfid->dm_fid_pad = 0;
memcpy(&dmfid->dm_fid_ino, &ip->i_ino, sizeof(dmfid->dm_fid_ino));
dmfid->dm_fid_gen = ip->i_generation;
*dmfsid = 11; // need generation system
return 0;
}
don't be bothered by the fsid. ;) i use to have exactly one filesystem
registered und every time the fsid is used, it's 11. ;)
the problem is, that the generated handle is wrong. dm_handle_is_valid()
says, that the handle is valid, but i cannot set a disposition e.g. if i
get a handle via dm_path_to_fshandle() or dm_path_to_handle() (says the
handle is bad).
on the other hand, if i set a global disposition, receive the mount event
and get the fshandle from the message, the handle seems to be correct?
maybe you can give ma a hint? is something wrong with dm_inode_to_fh()?
thanks in advance,
tim
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: vfs dmapi handle generation problem
2008-06-04 13:55 vfs dmapi handle generation problem Tim Jödicke
@ 2008-06-04 15:16 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2008-06-04 15:16 UTC (permalink / raw)
To: Tim J?dicke; +Cc: xfs
On Wed, Jun 04, 2008 at 03:55:04PM +0200, Tim J?dicke wrote:
> int
> vfs_dm_inode_to_fh(struct inode *ip, dm_fid_t *dmfid, dm_fsid_t *dmfsid)
> {
> dmfid->dm_fid_len = sizeof(dm_fid_t) - sizeof(dmfid->dm_fid_len);
> dmfid->dm_fid_pad = 0;
> memcpy(&dmfid->dm_fid_ino, &ip->i_ino, sizeof(dmfid->dm_fid_ino));
> dmfid->dm_fid_gen = ip->i_generation;
>
> *dmfsid = 11; // need generation system
>
> return 0;
i_ino in struct inode is unsigned long. If you run the above code
on a 32bit system you'll get crap in the upper half of dm_fid_ino.
Try:
int
vfs_dm_inode_to_fh(struct inode *ip, dm_fid_t *dmfid, dm_fsid_t *dmfsid)
{
dmfid->dm_fid_len = sizeof(dm_fid_t) - sizeof(dmfid->dm_fid_len);
dmfid->dm_fid_pad = 0;
dmfid->dm_fid_ino = ip->i_ino;
dmfid->dm_fid_gen = ip->i_generation;
*dmfsid = 11; // need generation system
return 0;
}
instead. If you actually want to support 64bit inode numbers on 32bit
systems you'll have to query for it with vfs_getattr, though.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-04 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-04 13:55 vfs dmapi handle generation problem Tim Jödicke
2008-06-04 15:16 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox