On Wed, Jan 24, 2024 at 03:26:03PM -0300, Wedson Almeida Filho wrote: > On Wed, 24 Jan 2024 at 02:23, Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > > > On Wed, Jan 24, 2024 at 05:05:43AM +0000, Matthew Wilcox wrote: > > > On Wed, Oct 18, 2023 at 09:25:18AM -0300, Wedson Almeida Filho wrote: > > > > +config TARFS_FS > > > > + tristate "TAR file system support" > > > > + depends on RUST && BLOCK > > > > + select BUFFER_HEAD > > > > > > I didn't spot anywhere in this that actually uses buffer_heads. Why > > > did you add this select? > > > > Oh, never mind. I found bread(). > > > > I'm not thrilled that you're adding buffer_head wrappers. We're trying > > to move away from buffer_heads. Any chance you could use the page cache > > directly to read your superblock? > > I used it because I saw it in ext4 and assumed that it was the > recommended way of doing it. I'm fine to remove it. > > So what is the recommended way? Which file systems are using it (so I > can do something similar)? e.g. btrfs_read_dev_one_super(). Essentially, if your superblock is at block zero in the block device: struct address_space *mapping = bdev->bd_inode->i_mapping; ...... page = read_cache_page_gfp(mapping, 0, GFP_NOFS); if (IS_ERR(page)) return ERR_CAST(page); super = page_address(page); And now you have a pointer to your in memory buffer containing the on-disk superblock. If the sueprblock is not at block zero, then replace the '0' passed to read_cache_page_gfp() with whatever page cache index the superblock can be found at.... -Dave. -- Dave Chinner david@xxxxxxxxxxxxx