What is the block size of ecryptfs when the lower filesystem uses a non-default size of 4Kb?

Asked by Ted_Smith on 2010-09-20

As I understand it, ext3 and ext4 (and sveeral other Linux filesystems) have a default block of size of 4Kb. eCryptfs matches this so that each new extent of 4Kb matches up to the lower FS.

But what if the user has a FS or if he configures his FS to use a block size of less that 4Kb? What would the eCryptfs block size be, for example, if the FS used a 1Kb or 2Kb block size? Would it just use 4 x 1Kb blocks per 1 eCryptfs block, or would it change it's own block size to suit?

Question information

Language:
English Edit question
Status:
Answered
For:
eCryptfs Edit question
Assignee:
No assignee Edit question
Last query:
2010-09-20
Last reply:
2010-09-21
Serge Hallyn (serge-hallyn) said : #1

> As I understand it, ext3 and ext4 (and sveeral other Linux filesystems)
> have a default block of size of 4Kb. eCryptfs matches this so that each
> new extent of 4Kb matches up to the lower FS.
>
> But what if the user has a FS or if he configures his FS to use a block
> size of less that 4Kb? What would the eCryptfs block size be, for
> example, if the FS used a 1Kb or 2Kb block size? Would it just use 4 x
> 1Kb blocks per 1 eCryptfs block, or would it change it's own block size
> to suit?

linux-2.6/fs/ecryptfs.c:ecryptfs_read_super() has the line:

        sb->s_blocksize = path.dentry->d_sb->s_blocksize;

So when doing the ecryptfs mount, it stores the underlying blocksize.

Can you help with this problem?

Provide an answer of your own, or ask Ted_Smith for more information if necessary.

To post a message you must log in.