All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phillip Lougher <phillip.lougher@gmail.com>
To: Ferenc Wagner <wferi@niif.hu>
Cc: linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-embedded@vger.kernel.org
Subject: Re: RFC: direct MTD support for SquashFS
Date: Fri, 19 Mar 2010 07:30:47 +0000	[thread overview]
Message-ID: <bffbecbb1003190030x4236abere54649131408cacc@mail.gmail.com> (raw)
In-Reply-To: <87d3z1unm9.fsf@tac.ki.iif.hu>

On Fri, Mar 19, 2010 at 1:05 AM, Ferenc Wagner <wferi@niif.hu> wrote:
> Ferenc Wagner <wferi@niif.hu> writes:
>
>> Phillip Lougher <phillip.lougher@gmail.com> writes:
>>
>>> On Thu, Mar 18, 2010 at 4:38 PM, Ferenc Wagner <wferi@niif.hu> wrote:
>>>
>>> +static int fill_bdev_super(struct super_block *sb, void *data, int silent)
>>> +{
>>> +    struct squashfs_sb_info *msblk;
>>> +    struct squashfs_bdev *bdev;
>>> +    int err = squashfs_fill_super2(sb, data, silent, &squashfs_bdev_ops);
>>> +    if (err)
>>> +            return err;
>>> +
>>> +    bdev = kzalloc(sizeof(*bdev), GFP_KERNEL);
>>> +    if (!bdev)
>>> +            return -ENOMEM;
>>> +
>>> +    bdev->devblksize = sb_min_blocksize(sb, BLOCK_SIZE);
>>> +    bdev->devblksize_log2 = ffz(~bdev->devblksize);
>>> +
>>> +    msblk = sb->s_fs_info;
>>> +    msblk->backend_data = bdev;
>>> +    return 0;
>>> +}
>>>
>>> This function looks rather 'back-to-front' to me.  I'm assuming that
>>> squashfs_fill_super2() will be the current fill superblock function?
>>
>> Yes, with the extra parameter added.
>>
>>> This function wants to read data off the filesystem through the
>>> backend, and yet the backend (bdev, mblk->backend_data) hasn't been
>>> initialised when it's called...
>>
>> It can't be, because msblk = sb->s_fs_info is allocated by
>> squashfs_fill_super().  Now it will be passed the ops, so after
>> allocating msblk it can also fill out the ops.  After that it can read,
>> and squashfs_read_data() will call the init, read and free operations of
>> the backend.
>
> And here we indeed have a rather fundamental problem.  This isn't
> specific to the discussed plugin system at all.  Even in the current
> code, to set msblk->block_size squashfs_fill_super() calls
> squashfs_read_table() to read the superblock, which in turn calls
> squashfs_read_data(), which uses msblk->block_size to allocate enough
> buffer heads, but msblk->block_size just can't be set at this point.
> msblk->bytes_used is preset with a dummy value to make the read
> possible, but msblk->block_size is not.  Fortunately, one buffer head is
> allocated each time nevertheless.  I wonder what a correct solution
> would look lke..

Block_size is known to be zero (the structure has been zeroed out at
alloc), and so it is known that the one block alloced in this case
will be correct.

Congratulations you've managed to really piss me off in your third or so email.

Cheers

Phillip

> --
> Regards,
> Feri.
>

  reply	other threads:[~2010-03-19  7:30 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 13:38 RFC: direct MTD support for SquashFS Ferenc Wagner
2010-03-16 13:38 ` Ferenc Wagner
2010-03-16 14:26 ` Peter Korsgaard
2010-03-16 14:26   ` Peter Korsgaard
2010-03-16 19:18   ` Vitaly Wool
2010-03-16 19:18     ` Vitaly Wool
2010-03-16 19:18     ` Vitaly Wool
2010-03-18 16:38   ` Ferenc Wagner
2010-03-18 16:38     ` Ferenc Wagner
2010-03-18 16:38     ` Ferenc Wagner
2010-03-18 16:38     ` Ferenc Wagner
2010-03-18 21:40     ` Phillip Lougher
2010-03-18 21:40       ` Phillip Lougher
2010-03-18 22:52       ` Ferenc Wagner
2010-03-19  1:05       ` Ferenc Wagner
2010-03-19  7:30         ` Phillip Lougher [this message]
2010-03-19 14:12           ` Ferenc Wagner
2010-03-23 11:34       ` Ferenc Wagner
2010-03-23 11:34         ` Ferenc Wagner
2010-03-23 20:45       ` Ferenc Wagner
2010-03-23 20:47       ` Ferenc Wagner
2010-03-23 20:47         ` Ferenc Wagner
2010-03-24  5:23         ` Phillip Lougher
2010-03-24  5:23           ` Phillip Lougher
2010-03-24  6:35           ` Peter Korsgaard
2010-03-24  6:35             ` Peter Korsgaard
2010-03-24 11:28             ` Ferenc Wagner
2010-03-24 11:35               ` Peter Korsgaard
2010-03-24 13:48           ` Ferenc Wagner
2010-03-24 13:48             ` Ferenc Wagner
2010-03-30 13:32             ` [PATCH 0/3] " Ferenc Wagner
2010-03-30 13:32             ` Ferenc Wagner
2010-03-30 13:32               ` Ferenc Wagner
2010-03-31  6:35               ` Marco Stornelli
2010-03-31  6:35                 ` Marco Stornelli
2010-03-30 13:32             ` [PATCH 1/3] squashfs: parametrize decompressors on buffer_head operations Ferenc Wagner
2010-03-30 13:32             ` Ferenc Wagner
2010-03-30 13:32               ` Ferenc Wagner
2010-03-30 13:32             ` [PATCH 2/3] squashfs: gather everything block device specific into block.c Ferenc Wagner
2010-03-30 13:32               ` Ferenc Wagner
2010-03-30 16:50               ` Ferenc Wagner
2010-03-30 16:50                 ` Ferenc Wagner
2010-03-30 13:32             ` Ferenc Wagner
2010-03-30 13:32             ` [PATCH 3/3] squashfs: add MTD backend Ferenc Wagner
2010-03-30 13:32               ` Ferenc Wagner
2010-03-30 13:32               ` Ferenc Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bffbecbb1003190030x4236abere54649131408cacc@mail.gmail.com \
    --to=phillip.lougher@gmail.com \
    --cc=linux-embedded@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=wferi@niif.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.