Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Linux slack space question

 
   Soft32 Home -> Linux -> Kernel RSS
Next:  parallel boot device initialisation (kernel-space..  
Author Message
Maria Short

External


Since: Dec 08, 2006
Posts: 1



(Msg. 1) Posted: Fri Dec 08, 2006 12:30 pm
Post subject: Linux slack space question
Archived from groups: linux>kernel (more info?)

I have a question regarding how the Linux kernel handles slack space.
I know that the ext3 filesystems typically use 1,2 or 4 KB blocks and
if a file is not an even multiple of the block size then the last
allocated block will not be completely filled, the remaining space is
wasted as slack space.

What I need is the code in the kernel that does that. I have been
looking at http://lxr.linux.no/source/fs/ext3/inode.c but I could not
find the specific code for partially filling the last block and
placing an EOF at the end, leaving the rest to slack space.

Please forward the answer to mgolod RemoveThis @ieee.org as soon as possible.

Thank you very much.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Bob Copeland

External


Since: Dec 08, 2006
Posts: 11



(Msg. 2) Posted: Fri Dec 08, 2006 12:50 pm
Post subject: Re: Linux slack space question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 12/8/06, Maria Short <mgolod DeleteThis @ieee.org> wrote:
> What I need is the code in the kernel that does that. I have been
> looking at http://lxr.linux.no/source/fs/ext3/inode.c but I could not
> find the specific code for partially filling the last block and
> placing an EOF at the end, leaving the rest to slack space.

There is no place where it writes an EOF. The size of the file is
stored in metadata (e.g. inode->i_size), and only the appropriate
number of blocks up to i_size are read or written to. Look at
ext3_get_block to see how blocks are read and allocated.

Bob
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
"linux-os

External


Since: Nov 15, 2006
Posts: 40



(Msg. 3) Posted: Fri Dec 08, 2006 2:00 pm
Post subject: Re: Linux slack space question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 8 Dec 2006, Maria Short wrote:

> I have a question regarding how the Linux kernel handles slack space.
> I know that the ext3 filesystems typically use 1,2 or 4 KB blocks and
> if a file is not an even multiple of the block size then the last
> allocated block will not be completely filled, the remaining space is
> wasted as slack space.
>

Not wasted, could be extended if additional data are written.

> What I need is the code in the kernel that does that. I have been
> looking at http://lxr.linux.no/source/fs/ext3/inode.c but I could not
> find the specific code for partially filling the last block and
> placing an EOF at the end, leaving the rest to slack space.

An EOF? Unlike CP/M the Linux file-systems copy to user-space up to the
last byte written to the file, not up to the last block. Therefore, there
is no need for "fill" and certainly no EOF character. All Linux/Unix
files are binary files, i.e., there are no special characters inserted.
Now, when you read a file using buffered I/O (the f***() functions), the
'C' runtime library converts I/O so that functions like feof(*stream) work.
The actual EOF on a binary file occurs when a read() returns 0 bytes.

The number of bytes actually written to files are handled in inodes. In fact,
you can make a file larger simply by moving a file-pointer. That changes
the inode value. Such files are called sparse files and, when read, the space
not written is cleared so the user never reads something that wasn't
specifically written.

>
> Please forward the answer to mgolod.RemoveThis@ieee.org as soon as possible.
>
> Thank you very much.
> -

Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.68 BogoMips).
New book: http://www.AbominableFirebug.com/
_


****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors.RemoveThis@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Erik Mouw

External


Since: Jan 10, 2005
Posts: 17



(Msg. 4) Posted: Mon Dec 11, 2006 12:40 pm
Post subject: Re: Linux slack space question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, Dec 08, 2006 at 12:21:04PM -0500, Maria Short wrote:
> I have a question regarding how the Linux kernel handles slack space.
> I know that the ext3 filesystems typically use 1,2 or 4 KB blocks and
> if a file is not an even multiple of the block size then the last
> allocated block will not be completely filled, the remaining space is
> wasted as slack space.
>
> What I need is the code in the kernel that does that. I have been
> looking at http://lxr.linux.no/source/fs/ext3/inode.c but I could not
> find the specific code for partially filling the last block and
> placing an EOF at the end, leaving the rest to slack space.

Think about it: what value would an EOF have if all byte values are
allowed in a file?

From the very first Unix filesystem an inode contains both the number
of blocks it contains and the actual file size.

> Please forward the answer to mgolod DeleteThis @ieee.org as soon as possible.

Hmm no. You asked a public forum so the reply will go to that same
public forum. See http://catb.org/esr/faqs/smart-questions.html#noprivate .


Erik

--
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Question: shutdown Linux from user space - Hi, I need to shutdown Linux from user level application. Which is the best way to do it? (I need it for embedded..

kernel space to user space /bin/sh startup - I am trying to boot linux on a PXA270 and I think I almost have it but the shell seems to not be outputting to the..

increase Linux kernel address space 3.5 G memory on Redhat.. - Hi: I am running Redhat Linux Enterprise version 4 update 4 on a dual-core 4G memory machine. There are many reference...

ARC-1260: No space left on device, when there is (or shoul.. - It seems I have a problem accessing the whole device, it filled up too quickly. I thought I was avoiding the 2tb limit....

Linux tty driver question - Hi, I'm working on Linux tty driver (based on tiny_tty). How can I provide in my driver Linux cat operation (e.g.cat ...

Question about spinlock in linux kernel - I found there is such a kernel symbol ".text.lock.spinlock", for example, # cat /proc/kallsyms | grep spinloc...
       Soft32 Home -> Linux -> Kernel All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]