LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 03-19-2024, 06:43 AM   #1
akhurange
LQ Newbie
 
Registered: Mar 2024
Posts: 1

Rep: Reputation: 0
Kernel 6.6 from block_device how to get the superblock?


Prior to kernel 6.6, struct block_device had member variable:

Code:
struct super_block *    bd_super;
One could check if the block device had a mounted file system or not by checking:

Code:
struct super_block *sb = bdev->bd_super;
if (!sb) {
       // block device is not mounted.
}
But from kernel 6.6., struct block_device doesnt has the member variable: bd_super. Now how to check if the block _device has a mounted file system or not?

Last edited by akhurange; 03-20-2024 at 12:03 AM.
 
Old 03-20-2024, 12:44 AM   #2
harry.hycc
LQ Newbie
 
Registered: Feb 2024
Posts: 4

Rep: Reputation: 2
You can use
struct *super_block;
sb = (struct super_block*)(bdev)->bd_holder

in https://www.kernel.org/doc/html/v6.6...s/porting.html
you can find that
The holder of a block device is now the superblock.

The holder of a block device used to be the file_system_type which wasn't particularly useful. It wasn't possible to go from block device to owning superblock without matching on the device pointer stored in the superblock. This mechanism would only work for a single device so the block layer couldn't find the owning superblock of any additional devices.
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
e2label: Superblock checksum does not match superblock while trying to open /dev/sdb3 Couldn't find valid filesystem superblock. Pen guin Linux - Newbie 26 07-05-2020 11:03 AM
Get struct block_device from device name pxhai Linux - Kernel 2 11-08-2012 11:36 AM
Kernel API *get_super (struct block_device *bdev) producing error with Fedora Core 5 ankur0921 Programming 1 02-02-2011 04:24 AM
How to get all block device's block_device pointer in kernel yinyang80 Linux - Kernel 0 12-16-2006 06:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 01:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration