* [Qemu-devel] Help needed -- vvfat.c
@ 2011-09-15 12:49 Pintu Kumar
2011-09-19 14:37 ` Kevin Wolf
0 siblings, 1 reply; 3+ messages in thread
From: Pintu Kumar @ 2011-09-15 12:49 UTC (permalink / raw)
To: qemu-devel
Hi,
This is regarding qemu block/vvfat.c.
Currently vvfat scans all directories and sub-directories in the
beginning during init_directories().
I want to modify vvfat such that it should scan only the TOP directory
content and not the sub-directory content before mounting.
And after mounting vvfat I should be able to dynamically get the TOP
directory content when I do "ls -l" on that directory.
How can I do that?
I tried skipping sub-directory in read_directory() as follows.
else if(S_ISDIR(st.st_mode))
{
LOGD("Skipping sub-directory : %s\n", buffer);
s->current_mapping=NULL;
continue;
}
After that the sub-directories are visible after mounting and part1 is working.
But after mounting when I do "ls -l" on vvfat mounted path, on any
directory, vvfat_read() is not getting called.
Somebody who knows about vvfat implementation please let me know where
is the problem.
Please help !.
Thanks, Regards,
Pintu Kumar
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] Help needed -- vvfat.c
2011-09-15 12:49 [Qemu-devel] Help needed -- vvfat.c Pintu Kumar
@ 2011-09-19 14:37 ` Kevin Wolf
2011-09-23 10:30 ` Pintu Kumar
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Wolf @ 2011-09-19 14:37 UTC (permalink / raw)
To: Pintu Kumar; +Cc: qemu-devel
Am 15.09.2011 14:49, schrieb Pintu Kumar:
> Hi,
>
> This is regarding qemu block/vvfat.c.
>
> Currently vvfat scans all directories and sub-directories in the
> beginning during init_directories().
>
> I want to modify vvfat such that it should scan only the TOP directory
> content and not the sub-directory content before mounting.
> And after mounting vvfat I should be able to dynamically get the TOP
> directory content when I do "ls -l" on that directory.
> How can I do that?
>
> I tried skipping sub-directory in read_directory() as follows.
> else if(S_ISDIR(st.st_mode))
> {
> LOGD("Skipping sub-directory : %s\n", buffer);
> s->current_mapping=NULL;
> continue;
> }
> After that the sub-directories are visible after mounting and part1 is working.
> But after mounting when I do "ls -l" on vvfat mounted path, on any
> directory, vvfat_read() is not getting called.
>
> Somebody who knows about vvfat implementation please let me know where
> is the problem.
I doubt that this is possible. A guest OS doesn't expect that data on
the disk changes when it didn't write to it. So for example, it could
read in the whole FAT and never really look at the on-disk FAT any more.
In practice, probably only parts of the FAT are cached, but that doesn't
help you. You never know which parts are cached, and anyway, even if you
knew which parts you may change, restricting changes to these parts of
the FATs would be tricky... vvfat is already complicated enough without
doing anything like this.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] Help needed -- vvfat.c
2011-09-19 14:37 ` Kevin Wolf
@ 2011-09-23 10:30 ` Pintu Kumar
0 siblings, 0 replies; 3+ messages in thread
From: Pintu Kumar @ 2011-09-23 10:30 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
On Mon, Sep 19, 2011 at 8:07 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> Am 15.09.2011 14:49, schrieb Pintu Kumar:
>> Hi,
>>
>> This is regarding qemu block/vvfat.c.
>>
>> Currently vvfat scans all directories and sub-directories in the
>> beginning during init_directories().
>>
>> I want to modify vvfat such that it should scan only the TOP directory
>> content and not the sub-directory content before mounting.
>> And after mounting vvfat I should be able to dynamically get the TOP
>> directory content when I do "ls -l" on that directory.
>> How can I do that?
>>
>> I tried skipping sub-directory in read_directory() as follows.
>> else if(S_ISDIR(st.st_mode))
>> {
>> LOGD("Skipping sub-directory : %s\n", buffer);
>> s->current_mapping=NULL;
>> continue;
>> }
>> After that the sub-directories are visible after mounting and part1 is working.
>> But after mounting when I do "ls -l" on vvfat mounted path, on any
>> directory, vvfat_read() is not getting called.
>>
>> Somebody who knows about vvfat implementation please let me know where
>> is the problem.
>
> I doubt that this is possible. A guest OS doesn't expect that data on
> the disk changes when it didn't write to it. So for example, it could
> read in the whole FAT and never really look at the on-disk FAT any more.
>
> In practice, probably only parts of the FAT are cached, but that doesn't
> help you. You never know which parts are cached, and anyway, even if you
> knew which parts you may change, restricting changes to these parts of
> the FATs would be tricky... vvfat is already complicated enough without
> doing anything like this.
>
> Kevin
>
--------------------------------------------------------------------------------------------------------------
Dear Mr. Kevin,
Thank you very much for your reply.
So according to your opinion it is not possible to perform dynamic
scanning and mapping of sub-directories after mounting the vvfat.
Actually,
In our case, we have implemented VVFAT as a daemon process on our
linux mobile device.
And developed a block driver (/dev/vvfat) to process the request from deamon.
(My vvfat device is mounted as :)
(/dev/vvfat 515584 32 515552 0% /mnt/vvfatfs)
2314 pts/0 S 0:00 ./vvfatd /opt/targetdir/
The real problem for us is : if the ext4 partition to be mounted as
VVFAT contains very large data (directory hierarchy and files) then it
may take longer time for VVFAT to mount.
So we wanted to perform only TOP directory scanning initially and then
after mounting if the user tries to access any
sub-directory we should be able to map rest of the contents on the fly.
To do partition scanning of only ROOT directory I used the following
logic in read_directory.
while(entry=readdir(dir))
{
----
----
if( (parent_mapping_index >= 0) && (!is_dotdot && !is_dot) )
break;
-----
-----
}
That is I am creating only _dot_ and _dotdot_ entries for the sub-directories.
With this logic I am able to skip the content of top directories and
also vvfat_read is invoked when I try to do
"ls -l" (ls -l /mnt/vvfatfs/test1/) on one of the top directory.
With this approach my content of the mounted vvfat were as follows:
ext4 path (Original Host OS)
============================
/opt/testdir/
-------------
|-file1.txt
|-test1
|_ .
|_ ..
|- dir1
|- .
|- ..
|- sample1.txt
VVFAT mount path (Guest OS)
============================
/mnt/vvfatfs/
-------------
|_ file1.txt
|_ test1
|- .
|- ..
Now my second approach is:
After the mount, we I use "ls -l /mnt/vvfatfs/test1", since vvfat_read
is called here, I could able to scan the content
of test1 from original ext4 location and map it to VVFAT partition.
But I am not able to do this.
I used the following in start of vvfat_read to perform this:-
1) Call read_directory again using the current mapping index with few
changes accordingly.
2) Using insert_mappings() to create new mappings for the rest of the contents.
3) Using insert_direntries() instead of insert_mappings().
4) Calling commit_mappings() after new mapping is created.
But none of this is working.
Please let me know the purpose of the following API:
- commit_mappings()
- insert_mappings()
- insert_direntries()
- commit_direntries()
Finally, the contact information for the author of VVFAT.
Thanks, Regards,
Pintu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-23 10:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-15 12:49 [Qemu-devel] Help needed -- vvfat.c Pintu Kumar
2011-09-19 14:37 ` Kevin Wolf
2011-09-23 10:30 ` Pintu Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).