Re: basic filesystem -- block size confusion

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

 



1) dd program issues number-of-writes="count" of size="bs". So in your
case, there will be 10 read sycalls of size 4096 bytes from /dev/zero
and 10 write syscalls of size 4096 on "nnn". You can verify this using
strace utility.

2) block size given at a time of filesystem creation affects the
actual data block size on the disk. You can verify it if you create a
file of size few bytes on such filesystem. "du" utility will give you
actual amount of disk blocks that are used.
e.g.
Filesystem with 1K blocksize

vinitd@pe-lt271:/mnt$ du -sh txt
1.0K	txt
vinitd@pe-lt271:/mnt$

Filesystem with 4K blocksize

vinitd@pe-lt271:/mnt$ du -sh txt
4.0K	txt
vinitd@pe-lt271:/mnt$

3) I have no idea about this point, may be someone else can explain it.

-Vinit

On Fri, Sep 11, 2009 at 10:53 AM, nidhi mittal hada
<nidhimittal19@xxxxxxxxx> wrote:
>
>> I was learning writing basic filesystem step by step-- till now what i
>> wrote just mounts .
>> Now
>> can someone help me to clarify the difference between
>>
>> 1)blocksize we give when we do 'dd if=/dev/zero of=nnn bs=4096 count=10
>> ans: in my view -- just to define size of file 4096 *10
>>
>> 2)block size we give wen we do  ./mkmyfs nnn 4096
>> ans while writing -- filesystem information -- to file -- this block size
>> is used
>>
>> 3)block size we have as
>> #define MYFS_DEFAULT_BS  which we set as sb->s_blocksize-- in fill_super
>> function -- before doing sb_bread of disk super block
>>   while mounting -- while reading filesystem info from the file-- this
>> blocksize is used
>>
>> 4)in testfs  ---  sb_min_blocksize() was used  --- before sb_bread in fill
>> super --
>> wherein minimum of the two
>> 'MYFS_DEFAULT_BS'   and    bdev_hardsect_size(sb->s_bdev)
>> is set as sb->s_blocksize
>> what is bdev_hardsect_size ??
>> what's d logic behind using minimum of these two Please CMIIW
>>
>> On Wed, Sep 2, 2009 at 4:11 PM, SandeepKsinha <sandeepksinha@xxxxxxxxx>
>> wrote:
>>>
>>> NIdhi,
>>>
>>>
>>> On Wed, Sep 2, 2009 at 2:45 PM, nidhi mittal
>>> hada<nidhimittal19@xxxxxxxxx> wrote:
>>> >
>>> > Hi All
>>> > "I am writing for learning purpose a basic filesystem that just mounts
>>> > loads super block and root inode from disk."
>>> >
>>> > Now i am facing a problem
>>> > when i do
>>> >
>>> > mount -t myfs2 utils/nnn /mnt -o loop ----- it stucks here ....
>>> >
>>> > then doing
>>> > ps -ax | grep -i mount    shows the    mount script is in  RL state
>>> > where R - is in run queue
>>> > L -- pages locked in memory
>>> >
>>> >
>>> > and i found by using printks that
>>> > when i read disk inode block through sb_bread(sb,MYFS_INODE_BLOCK)
>>> > then it happens....and sb_bread doesnt return back .
>>> >
>>> > point to be noted is in my code snippet
>>> > just before reading inode block i read super block -- it works
>>> > perfectly but
>>> > --
>>> > as i read inode block it stucks ...
>>> >
>>> > /*****************************
>>> >
>>> >        if(!(bh=(struct buffer_head *)sb_bread(sb,MYFS_SUPER_
>>> > BLOCK)))
>>> >         {
>>> >            printk(KERN_ALERT"Cannot read superblock of MYFS \n");
>>> >            goto free;
>>> >         }
>>> >
>>> >
>>> >       printk(KERN_ALERT"i m going to read disk inode in block number
>>> > %d",MYFS_INODE_BLOCK);
>>> >     /* IT Prints this message and stucks somewhere inside sb_bread*/
>>> >         if(!(bi=(struct buffer_head *)sb_bread(sb,MYFS_INODE_BLOCK)))
>>> >         {
>>> >           printk(KERN_ALERT"Cannot read inode clock  of MYFS \n");
>>> >           goto free;
>>> >         }
>>> >
>>> >
>>> >
>>> > ****************************/
>>> > i have tested through many ways -- in userspace it shows that inode was
>>> > written perfectly ...
>>> > what can be this thing?
>>> > i checked all parameters of sb -- bdev,blocksize,blocknumber okay
>>> > before
>>> > sb_bread
>>> >
>>>
>>> Can you provide the complete sources, so that it becomes easier to
>>> understand the problem?
>>> Also, I would suggest your to list out the problems in points.
>>>
>>> >
>>> > any help will be obliging !!
>>> >
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Sandeep.
>>>
>>>
>>>
>>>
>>>
>>>
>>> “To learn is to change. Education is a process that changes the learner.”
>>
>>
>>
>> --
>> Thanks & Regards
>> Nidhi Mittal Hada
>
>
>
> --
> Thanks & Regards
> Nidhi Mittal Hada
>

--
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