From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Kathy KN (HK)" Subject: Re: Access content of file via inodes Date: Thu, 7 Apr 2005 13:25:08 +0800 Message-ID: References: <1112787226.21605.27.camel@imp.csi.cam.ac.uk> Reply-To: "Kathy KN (HK)" Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Jeff Mahoney , Bryan Henderson , linux-fsdevel@vger.kernel.org Return-path: Received: from zproxy.gmail.com ([64.233.162.201]:17869 "EHLO zproxy.gmail.com") by vger.kernel.org with ESMTP id S261241AbVDGFZJ (ORCPT ); Thu, 7 Apr 2005 01:25:09 -0400 Received: by zproxy.gmail.com with SMTP id 18so136967nzp for ; Wed, 06 Apr 2005 22:25:08 -0700 (PDT) To: Anton Altaparmakov In-Reply-To: <1112787226.21605.27.camel@imp.csi.cam.ac.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org > Looking at reiserfs code in the current 2.6 kernel it does: > > .bmap = reiserfs_aop_bmap, > > Which is: > > static sector_t reiserfs_aop_bmap(struct address_space *as, sector_t > block) { > return generic_block_bmap(as, block, reiserfs_bmap) ; > } > > And generic_block_bmap is: > > sector_t generic_block_bmap(struct address_space *mapping, sector_t > block, > get_block_t *get_block) > { > struct buffer_head tmp; > struct inode *inode = mapping->host; > tmp.b_state = 0; > tmp.b_blocknr = 0; > get_block(inode, block, &tmp, 0); > return tmp.b_blocknr; > } > > It ignores any errors from get_block() and always returns tmp.b_blocknr. > Thus is get_block() fails, tmp.b_blocknr is 0 and hence 0 is returned, > i.e. a sparse block. Which is complete rubbish... > > And get_block in this case in reiserfs is: > > static int reiserfs_bmap (struct inode * inode, sector_t block, > struct buffer_head * bh_result, int create) > { > if (!file_capable (inode, block)) > return -EFBIG; > > reiserfs_write_lock(inode->i_sb); > /* do not read the direct item */ > _get_block_create_0 (inode, block, bh_result, 0) ; > reiserfs_write_unlock(inode->i_sb); > return 0; > } Just wondering. Say, reiserfs/r4, how is it possible to access the tail which contain the data of the file, since most of our production boxes uses either reiserfs and/or reiser4. Kathy