Re: What is the difference between loopback device and ramdisk device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Peter.

On Wed, Mar 4, 2009 at 11:45 PM, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote:
> all the question u asked are answered by yourself.   :=).
>
> but i do have some questions (MinChan or anyone else can help?):
>
> a.   after mounting the ramdisk or loopback file as devices, and
> configuring it as say, ext2 filesystem, all I/O processing go through
> the same processing sequence:   syscalls->vfs layer->ext2 FS
> layer->pagecache layer->block layer->block devices->loopback
> (drivers/block/loop.c) or ramdisk (drivers/block/brd.c) layer,
> correct?
>
> Now the problem with that is "double buffering" or duplicated caching
> -> one at the pagecache layer, and another at the ramdisk level.

Yes. It is not good in that case.
So, kernel developers make ramfs
The ramfs just use page cache's pages so that you can avoid duplication.

You can refer it in Documentation/filesystems/ramfs-rootfs-initramfs.txt

> (don't forget another duplication of caching between userspace memory
> and pagecache).
>
> Or is Linux Kernel much smarter than that?
>
> b.   At the "block layer" processing as listed in sequence above, it
> will be subjected to I/O scheduling.   Correct?   But since ramdisk
> are not subjected to any I/O latency problems, should this read over
> write prioritizing (or batching of read/write) as done by I/O
> scheduler be unnecessary?

You can compare __make_request and [brd/loop]_make_request.
__make_request is generic function to handle elevator algorithm.
but, [brd/loop]_make_request never do things related to elevator.

> On Tue, Mar 3, 2009 at 4:48 PM, loody <miloody@xxxxxxxxx> wrote:
>> Dear all:
>> After reading the page
>> http://tldp.org/HOWTO/archived/Loopback-Root-FS/Loopback-Root-FS-2.html,
>> I have some questions about these 2 devices.
>> 1. Are both loopback device and ramdisk device virtual device?
>>   ( it seems so, since they both don't have any physical devices)
>> 2. The only differences between them is loopdevice uses file as
>> virtual device and ramdisk uses memory as virtual device
>>   (if it is also right, why we first use dd if=file_name
>> of=/dev/loop, then we mount -o loop /dev/loop /mnt.
>>    It seems we copy the file content to a virtual memory device,
>> /dev/loop, then mount it.
>>    So we still use a block of ram to simulation the file operation, right?)
>> thanks for your help,
>> miloody
>>
>
>
>
> --
> Regards,
> Peter Teoh
>



-- 
Kinds regards,
Minchan Kim

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux