Problem in getting the physical block number for new file in EXT4 through cat/echo
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Problem in getting the physical block number for new file in EXT4 through cat/echo
Hi,
I am doing a project in EXT4 ,and I am facing one problem..
1)When I am creating a new file and writing into it through cat/echo, the functions(ext4_mb_new_blocks) of mballoc are not getting called,so I am not able to get the required physical block number..
However when doing the same with vim/gedit or even when overwriting the file with cat/echo the functions are getting called and I am able to get the required physical block number and when verifying it with blkcat the data gets printed properly...
My aim is to get the phy block number for the new file...
I have just written a simple prog say hello world in a.txt..
And I am running the command:
cat a.txt > b.txt
above command I am executing when b.txt is not there.
Now if b.txt has some data already ,then only I am able to get the phy. blk number of b.txt(by executing the abv command), otherwise not.
the shell creates the empty file b.txt. Since nothing has yet been written to the file, no physical blocks have yet been allocated.
Ok b.txt is treated as a empty file, but since a.txt has some data, we are actually writing the data of a.txt to b.txt...so we should get the block number for b.txt???
Yes, it certainly should. Sorry, but it is not clear exactly when and how you are trying to get the block number for b.txt.
We are trying to get the phy block number of b.txt through ext4_mb_new_blocks() in mballoc.c where actually you get the starting phy block number..we were getting phy blk no. when we are overwriting in b.txt through cat...
Now we are using vim since we were getting problem through cat...
Do you know the name of the buffer that vim uses ?..I want to edit its buffer size, since it is by default set to 8192 bytes..I am using Fedora 14...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.