mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [HOWTO...] LUFS, readpage and large files
@ 2004-06-04 15:51 Eduard Bloch
  2004-06-05  4:50 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Eduard Bloch @ 2004-06-04 15:51 UTC (permalink / raw)
  To: linux-kernel

Hello,

while writting a new LUFS plugin (to emulate large file support on
FAT32;) I stumbled over a problem with it's kernel communication module.
The symptoms were the same as with broken programs that use int or long
int instead of size_t (or even long long) for storing file offsets.
However, here the broken offsets (modulo 4GB) came from kernel so I
traced it down to this method:

static int lu_file_readpage(struct file *f, struct page *p)
{
    int res;
    struct iovec siov[3], riov;
    long long offset;
    unsigned long count;
    struct server_slot *slot;

    TRACE("in\n");

    if((slot = lu_getslot(GET_INFO(f->f_dentry->d_sb))) == NULL)
    	return -ERESTARTSYS;

    get_page(p);

    if((res = lu_getname(f->f_dentry, slot->s_buf, LU_MAXDATA)) < 0){
      WARN("lu_getname failed!\n");
      goto out;
    }

    offset = p->index << PAGE_CACHE_SHIFT;
    count = PAGE_SIZE;

The problem is, page->index indeed contains a short datatype for offset -
...but where to get the correct data? (the long long offset).

I tried to look at how other filesystems manage it but they become too
complex when it comes to details. Unfortunately, most documentation
about VFS and filesystems (found on Internet) simply sucks when it comes
to such details, especially for Large Files.
The autors simply refer to "block lockup methods" or similar things but
nobody gives an example explanation or correct description of how the
way of the data should like (complete - all steps between the request,
page allocation, translation of addresses etc.pp.).

Regards,
Eduard.
-- 
Eine Freude vertreibt hundert Sorgen.

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: [HOWTO...] LUFS, readpage and large files
@ 2004-06-04 16:46 Miklos Szeredi
  0 siblings, 0 replies; 3+ messages in thread
From: Miklos Szeredi @ 2004-06-04 16:46 UTC (permalink / raw)
  To: Eduard Bloch; +Cc: linux-kernel


> while writting a new LUFS plugin (to emulate large file support on
> FAT32;) I stumbled over a problem with it's kernel communication module.
> The symptoms were the same as with broken programs that use int or long
> int instead of size_t (or even long long) for storing file offsets.
> However, here the broken offsets (modulo 4GB) came from kernel so I
> traced it down to this method:

[...]

>     offset = p->index << PAGE_CACHE_SHIFT;

This should be:

     offset = (unsigned long long) p->index << PAGE_CACHE_SHIFT;

BTW, you can use FUSE + LUFIS for running LUFS filesystems with the
FUSE kernel module. Or even better: you can write your filesystem
natively with FUSE ;)

You can download LUFIS from http://sourceforge.net/projects/avf, FUSE
is already in debian testing.

Cheers,
Miklos



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-06-05  4:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-04 15:51 [HOWTO...] LUFS, readpage and large files Eduard Bloch
2004-06-05  4:50 ` Andrew Morton
2004-06-04 16:46 Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®