FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Thu May 13, 2021 21:59



Post new topic Reply to topic  [ 10 posts ] 
Cluster read/write 
Author Message

Joined: Thu Mar 29, 2012 20:33
Posts: 5
Post Cluster read/write
Hi,

I'm looking for the ability to develop a customized way of reading/and writing from and to clusters. I've tried reading the documentation, but was unable to find such information. Is it possible to locate the routines that read/write to clusters when reading and writing files and modify them in NTFS3G?

Appreciate all the feedback.

- MAA


Thu Mar 29, 2012 20:38
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Cluster read/write
Hi,

Quote:
I'm looking for the ability to develop a customized way of reading/and writing from and to clusters.

To implement low level device access, you have to provide an array of ten functions (open, read, seek, etc.). There are two implementations in the open source code (unix_io.c and win32_io.c), which you can adapt to your needs.

Regards

Jean-Pierre


Fri Mar 30, 2012 08:56
Profile

Joined: Thu Mar 29, 2012 20:33
Posts: 5
Post Re: Cluster read/write
Thank you for your reply.

I'm actually working on a project where I need to reserve a segment of every cluster in the hard disk for some specific function.
I would like the filesystem when executing a read or write operation to utilize only part of the clusters in the HD, and
the reserved segment of the clusters to be used utilizing some system wide variables. So for example, I would like a read
operation to only return a certain part of the cluster, and the write operation to only write on a certain part of the cluster.

So far, I think NTFS 3G will give me the ability to have filesystem wide variables that I can utilize for my computations.
But I'm not sure if the file access operations implemented by NTFS 3G will give me the ability to manipulate clusters the
way I would like.

I've read the source code in both unix_io.c and win32_io.c, and wasn't able to find a point where I can interact with clusters.
Or is this something that must be done through the kernel?

Regards,
- MAA


Tue May 15, 2012 22:08
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Cluster read/write
Hi,

Quote:
I'm actually working on a project where I need to reserve a segment of every cluster in the hard disk for some specific function.
I would like the filesystem when executing a read or write operation to utilize only part of the clusters in the HD, and
the reserved segment of the clusters to be used utilizing some system wide variables. So for example, I would like a read
operation to only return a certain part of the cluster, and the write operation to only write on a certain part of the cluster.

You could reserve a specific file for your extra data. If you need S bytes per cluster, you get/put them at position cluster*S when reading/writing the said cluster. You have of course to deal with reading/writing clusters which are part of the specific file.

Regards

Jean-Pierre


Wed May 16, 2012 21:20
Profile

Joined: Thu Mar 29, 2012 20:33
Posts: 5
Post Re: Cluster read/write
jpa wrote:
Hi,
You could reserve a specific file for your extra data. If you need S bytes per cluster, you get/put them at position cluster*S when reading/writing the said cluster. You have of course to deal with reading/writing clusters which are part of the specific file.

Regards

Jean-Pierre


Thanks Jean-Pierre.

I think I phrased my question incorrectly, I apologize for that. I need to reserve a part of every cluster, to be embedded with some special information. So I would like applications running on top of my NTFS 3G to read and write only say half of every cluster, and I handle the rest of the space in every cluster. So for example, let's say an application want to write data to clusters 1,2 and 3. I would like the filesystem to only enable the application to read/write data from/to half of every cluster, so half of cluster 1, half of cluster 2, and half of cluster 3.

Is such interaction/modification to NTFS 3G possible?

Again, thanks JPA for your much appreciated feedback.

Regards,
- MAA


Wed May 16, 2012 22:00
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Cluster read/write
Hi,
Quote:
I would like the filesystem to only enable the application to read/write data from/to half of every cluster, so half of cluster 1, half of cluster 2, and half of cluster 3.

Is such interaction/modification to NTFS 3G possible?

Of course you can. Whenever the file system requests reading/writing cluster C, you read/write half of it at cluster 2*C, and the other half at cluster 2*C+1. You will have to deal with reading/writing several clusters at a time or partial clusters. If you do so within the library, this will also apply to utilities, and among them to mkntfs for formatting.

Regards

Jean-Pierre


Thu May 17, 2012 09:47
Profile

Joined: Thu Mar 29, 2012 20:33
Posts: 5
Post Re: Cluster read/write
Thanks Jean-Pierre.

In trying to identify where in the NTFS 3G code I can interact with clusters, I went over win32_io.c and was not able to find code that interacts with the clusters directly. The impression I got is the code there deals with complete read, write seek, ... etc operations, and abstracts the cluster interaction. If you can please point me to where I can find such interaction, I would truly appreciate it.

Again thanks for the feedback.

- MAA


Thu May 17, 2012 19:28
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Cluster read/write
Hi,

Quote:
I went over win32_io.c and was not able to find code that interacts with the clusters directly. The impression I got is the code there deals with complete read, write seek, ... etc operations, and abstracts the cluster interaction.

This is the point in the file system nearest to the hardware. Lower levels managing the caches and partial sector read/writes, reordering read/write requests, computing absolute disk offsets, etc. are common to all file systems, so they are just called from each of them.
Quote:
If you can please point me to where I can find such interaction, I would truly appreciate it.

If I understood correctly what you want and you want it at the file system level, you may double the offsets requested in seeks, and split the reads and writes to act on a single cluster at a time to leave space and fill in the extra data you want to insert.

Now, if you want it at a lower level and applicable to all file systems, you have to dig into the kernel....

Regards

Jean-Pierre


Thu May 17, 2012 21:42
Profile

Joined: Thu Mar 29, 2012 20:33
Posts: 5
Post Re: Cluster read/write
jpa wrote:
If I understood correctly what you want and you want it at the file system level, you may double the offsets requested in seeks, and split the reads and writes to act on a single cluster at a time to leave space and fill in the extra data you want to insert.


Thanks.

Actually yes. What I want exactly is to split every read and write operation to act on every single cluster involved in those operation. So what I'm understanding is by working on modifying win32_io.c or linux_io.c I can achieve that without needing to alter the underlying kernel?

Again, thanks Jean-Pierre for all your help.

Regards,
- MAA


Thu May 17, 2012 22:01
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Cluster read/write
Hi,

Quote:
What I want exactly is to split every read and write operation to act on every single cluster involved in those operation. So what I'm understanding is by working on modifying win32_io.c or linux_io.c I can achieve that without needing to alter the underlying kernel?

This is how I would do it.

Regards

Jean-Pierre


Fri May 18, 2012 08:38
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.