kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* how do i read a block
@ 2013-05-13  8:05 shampavman
  2013-05-13 14:32 ` Valdis.Kletnieks at vt.edu
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: shampavman @ 2013-05-13  8:05 UTC (permalink / raw)
  To: kernelnewbies

Hi all,

Supposing i create a file of size 10K, it will occupy 2 blocks (4K each).
Now if i want to read only 1 block from it how can i do it?

read(fd, buf, 4096) ;
would this mean i would read the first block and all its contents?

Thanks

^ permalink raw reply	[flat|nested] 9+ messages in thread
* how do i read a block
@ 2013-05-15 13:43 Shampavman
  0 siblings, 0 replies; 9+ messages in thread
From: Shampavman @ 2013-05-15 13:43 UTC (permalink / raw)
  To: kernelnewbies

Sorry imeant 3blocks 

Sankar P <sankar.curiosity@gmail.com> wrote:

>On Mon, May 13, 2013 at 1:35 PM, shampavman <shampavman.cg@gmail.com> wrote:
>> Hi all,
>>
>> Supposing i create a file of size 10K, it will occupy 2 blocks (4K each).
>> Now if i want to read only 1 block from it how can i do it?
>>
>
>It will require 3 blocks.
>
>
>> read(fd, buf, 4096) ;
>> would this mean i would read the first block and all its contents?
>>
>
>It may be read even further (readahead)
>
>If you are in kernel mode, and if you want to implement your own
>filesystem and want to read a single block, you can use the sb_bread
>function.
>
>
>--
>Sankar P
>http://psankar.blogspot.com

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

end of thread, other threads:[~2013-05-15 13:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-13  8:05 how do i read a block shampavman
2013-05-13 14:32 ` Valdis.Kletnieks at vt.edu
2013-05-13 16:22 ` Matthias Brugger
2013-05-14  6:29   ` Prashant Shah
2013-05-14  6:35     ` shampavman
2013-05-14 20:17       ` Valdis.Kletnieks at vt.edu
2013-05-14 20:26 ` Manish Katiyar
2013-05-15  9:10 ` Sankar P
  -- strict thread matches above, loose matches on Subject: below --
2013-05-15 13:43 Shampavman

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