From: shampavman.cg@gmail.com (shampavman)
To: kernelnewbies@lists.kernelnewbies.org
Subject: how do i read a block
Date: Tue, 14 May 2013 12:05:32 +0530 [thread overview]
Message-ID: <5191DB34.2010206@gmail.com> (raw)
In-Reply-To: <CAD6i1f+a8Xow3KEheNrOY+_dScYaD_w7TWieadBJYnuGWCV7fQ@mail.gmail.com>
On 05/14/2013 11:59 AM, Prashant Shah wrote:
> Hi,
>
> On Mon, May 13, 2013 at 9:52 PM, Matthias Brugger
> <matthias.bgg@gmail.com> wrote:
>> El 13/05/2013 10:07, "shampavman" <shampavman.cg@gmail.com> va escriure:
>>
>>
>>> 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?
> One way to do this is use the FIBMAP ioctl to the get the block
> numbers of a file and then seek the disk /dev/sdX directly and use the
> read() to get data block.
But why does a simple read not turn out 1 block for me?
Eg, i know my block size if 4k and my file (according to du) reports
that it's using 8k of space.
So when i read the file via the read() and ask it to give me the 'first
4k' bytes, would that not return 1 block ?
thanks
>
> Regards.
next prev parent reply other threads:[~2013-05-14 6:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=5191DB34.2010206@gmail.com \
--to=shampavman.cg@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/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.