From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Luedtke Subject: Mapping anomalous blocksizes blksize Date: Thu, 21 Jun 2012 20:04:20 +0200 Message-ID: <1340301860.11487.17.camel@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit To: linux-fsdevel@vger.kernel.org Return-path: Received: from mail.nonattached.net ([193.160.39.60]:60859 "EHLO mail.nonattached.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753528Ab2FUSE3 (ORCPT ); Thu, 21 Jun 2012 14:04:29 -0400 Received: from [IPv6:2001:4dd0:ffa8:10:21f:16ff:fe0a:29ae] (tunafish.nonattached.net [IPv6:2001:4dd0:ffa8:10:21f:16ff:fe0a:29ae]) by mail.nonattached.net (Postfix) with ESMTPSA id EBA7FDFFA for ; Thu, 21 Jun 2012 20:04:21 +0200 (CEST) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hallo everyone, another question regarding filesystem implementation, sorry for bugging you again. I wrote myfs_read() and myfs_write() with simple copy_from_user() and copy_to_user() calls and I am trying to "upgrade" them to the way other filesystems are doing it (paging, get_blk() and stuff, still reading and understanding...). Currently I am facing problems when it comes to blocksizes. The filesystem's blocksizes are multiples of 512 bytes minus 2 bytes for header information. All blocks on the same device have the same blocksize, the size is determined by the module at mounting time and stored in superblock private data. So blocksizes can be e.g. 510+2 or maybe 4094+2 bytes. If I understood correctly how struct inode stores the blocksizes, I have doubts that it is even possible to map 4094 [sic!] bytes of data into a page. include/linux/fs.h: 761 struct inode { 762 umode_t i_mode; ... 821 atomic_t i_count; 822 unsigned int i_blkbits; <--- 823 u64 i_version; And in various other locations I found lines like: blksize = 1 << inode->i_blkbits; or like: inode->i_blkbits = ilog2(blksize); There is no way to express 4094 correctly this way, is it? But 2**12 is 4096, and then the two header-bytes would be included :/ Don't hesitate to ask for further information, I might sound confused right now. Any help is appreciated, you are free to direct me to files in Documentation/ if I overlooked something. Thanks! Dan -- Dan Luedtke http://www.danrl.de