diff mbox

[v3,01/39] fs: introduce a ->s_cdev field into struct super_block

Message ID 1442307754-13233-2-git-send-email-yangds.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yang Dongsheng Sept. 15, 2015, 9:01 a.m. UTC
There are some filesystems are running on char devs, such
as ubifs. So we need a field in super_block to hold a
reference to the char device.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 include/linux/fs.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Christoph Hellwig Oct. 4, 2015, 6:31 a.m. UTC | #1
On Tue, Sep 15, 2015 at 05:01:56PM +0800, Dongsheng Yang wrote:
> There are some filesystems are running on char devs, such
> as ubifs. So we need a field in super_block to hold a
> reference to the char device.

We only care about the block device to get a device number to return
in st.st_dev.  And while filesystem literally run on top of a block
device that is not the case of a character device - you might use a
chardev to identify a device to mount but it'll never use the actual
char device.

So please don't bloat the superblock with this.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Kara Oct. 5, 2015, 8:36 a.m. UTC | #2
On Sat 03-10-15 23:31:19, Christoph Hellwig wrote:
> On Tue, Sep 15, 2015 at 05:01:56PM +0800, Dongsheng Yang wrote:
> > There are some filesystems are running on char devs, such
> > as ubifs. So we need a field in super_block to hold a
> > reference to the char device.
> 
> We only care about the block device to get a device number to return
> in st.st_dev.  And while filesystem literally run on top of a block
> device that is not the case of a character device - you might use a
> chardev to identify a device to mount but it'll never use the actual
> char device.
> 
> So please don't bloat the superblock with this.

Hum, interesting idea. You're right that using anon bdev ubifs got assigned
in set_anon_super() would work as well. It may be slightly confusing for
quota-tools usage where specifying char device on command line would not
work (specifying block device to identify filesystem works there). But
using mount point would work fine so the situation would be the same as
with network filesystems.

We could even add a translation in quota-tools to convert char device to
corresponding anon block device if there's a reasonably simple way to do
that in userspace or we could translate in quotactl code in kernel if
that's any easier. But currently I don't see a way how we could easily do
either of those.

								Honza
diff mbox

Patch

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 84b783f..9896b62 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1313,6 +1313,7 @@  struct super_block {
 	struct hlist_bl_head	s_anon;		/* anonymous dentries for (nfs) exporting */
 	struct list_head	s_mounts;	/* list of mounts; _not_ for fs use */
 	struct block_device	*s_bdev;
+	struct cdev		*s_cdev;
 	struct backing_dev_info *s_bdi;
 	struct mtd_info		*s_mtd;
 	struct hlist_node	s_instances;