* Linux filesystem configuration infrastructure
@ 2014-08-04 4:50 ` Sankar P
0 siblings, 0 replies; 8+ messages in thread
From: Sankar P @ 2014-08-04 4:50 UTC (permalink / raw)
To: kernelnewbies
Hi,
I have a simple filesystem that I did for learning purpose
https://github.com/psankar/simplefs
Now, I would like to add a few settings to my filesystem (such as the
number of blocks that should be allocated in an extent by default,
maximum fragmentation score after which defrag should be automatically
handled etc.) I would like to have the ability to not just set these
settings, but export them to a file and restore these settings later.
Is there some kind of a settings infrastructure code that is available
in the linux kernel or should I be developing something specific to my
filesystem ?
I would also like to have some kind of validation system also as part
of the settings interface. For example: If a setting can accept only
ints, trying to set a string to that should be disabled, min and max
values (range) for values of settings, etc.
I googled and found that sysctl interface and the sysfs interfaces
seem to be doing something similar. But I was not sure which to pick
as the wikipedia pages were not as elaborate as I would like.
So my question is: Is there a settings infrastructure provided by the
linux kernel and is any filesystem (or any other kernel components)
that make use of such a settings infrastrucutre ?
Thanks.
--
Sankar P
http://psankar.blogspot.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Linux filesystem configuration infrastructure
@ 2014-08-04 4:50 ` Sankar P
0 siblings, 0 replies; 8+ messages in thread
From: Sankar P @ 2014-08-04 4:50 UTC (permalink / raw)
To: kernelnewbies, linux-fsdevel
Hi,
I have a simple filesystem that I did for learning purpose
https://github.com/psankar/simplefs
Now, I would like to add a few settings to my filesystem (such as the
number of blocks that should be allocated in an extent by default,
maximum fragmentation score after which defrag should be automatically
handled etc.) I would like to have the ability to not just set these
settings, but export them to a file and restore these settings later.
Is there some kind of a settings infrastructure code that is available
in the linux kernel or should I be developing something specific to my
filesystem ?
I would also like to have some kind of validation system also as part
of the settings interface. For example: If a setting can accept only
ints, trying to set a string to that should be disabled, min and max
values (range) for values of settings, etc.
I googled and found that sysctl interface and the sysfs interfaces
seem to be doing something similar. But I was not sure which to pick
as the wikipedia pages were not as elaborate as I would like.
So my question is: Is there a settings infrastructure provided by the
linux kernel and is any filesystem (or any other kernel components)
that make use of such a settings infrastrucutre ?
Thanks.
--
Sankar P
http://psankar.blogspot.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Linux filesystem configuration infrastructure
2014-08-04 4:50 ` Sankar P
@ 2014-08-04 5:21 ` Greg KH
-1 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2014-08-04 5:21 UTC (permalink / raw)
To: kernelnewbies
On Mon, Aug 04, 2014 at 10:20:35AM +0530, Sankar P wrote:
> Hi,
>
> I have a simple filesystem that I did for learning purpose
> https://github.com/psankar/simplefs
>
> Now, I would like to add a few settings to my filesystem (such as the
> number of blocks that should be allocated in an extent by default,
> maximum fragmentation score after which defrag should be automatically
> handled etc.) I would like to have the ability to not just set these
> settings, but export them to a file and restore these settings later.
> Is there some kind of a settings infrastructure code that is available
> in the linux kernel
configfs, but usually a filesystem doesn't need anything so complex,
just use the "normal" mount option way and you should be fine.
> I would also like to have some kind of validation system also as part
> of the settings interface. For example: If a setting can accept only
> ints, trying to set a string to that should be disabled, min and max
> values (range) for values of settings, etc.
Again, configfs is good for "complex" configurations.
Good luck,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Linux filesystem configuration infrastructure
@ 2014-08-04 5:21 ` Greg KH
0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2014-08-04 5:21 UTC (permalink / raw)
To: Sankar P; +Cc: kernelnewbies, linux-fsdevel
On Mon, Aug 04, 2014 at 10:20:35AM +0530, Sankar P wrote:
> Hi,
>
> I have a simple filesystem that I did for learning purpose
> https://github.com/psankar/simplefs
>
> Now, I would like to add a few settings to my filesystem (such as the
> number of blocks that should be allocated in an extent by default,
> maximum fragmentation score after which defrag should be automatically
> handled etc.) I would like to have the ability to not just set these
> settings, but export them to a file and restore these settings later.
> Is there some kind of a settings infrastructure code that is available
> in the linux kernel
configfs, but usually a filesystem doesn't need anything so complex,
just use the "normal" mount option way and you should be fine.
> I would also like to have some kind of validation system also as part
> of the settings interface. For example: If a setting can accept only
> ints, trying to set a string to that should be disabled, min and max
> values (range) for values of settings, etc.
Again, configfs is good for "complex" configurations.
Good luck,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Linux filesystem configuration infrastructure
2014-08-04 4:50 ` Sankar P
@ 2014-08-04 15:00 ` Jan Kara
-1 siblings, 0 replies; 8+ messages in thread
From: Jan Kara @ 2014-08-04 15:00 UTC (permalink / raw)
To: kernelnewbies
Hello,
On Mon 04-08-14 10:20:35, Sankar P wrote:
> I have a simple filesystem that I did for learning purpose
> https://github.com/psankar/simplefs
>
> Now, I would like to add a few settings to my filesystem (such as the
> number of blocks that should be allocated in an extent by default,
> maximum fragmentation score after which defrag should be automatically
> handled etc.) I would like to have the ability to not just set these
> settings, but export them to a file and restore these settings later.
> Is there some kind of a settings infrastructure code that is available
> in the linux kernel or should I be developing something specific to my
> filesystem ?
>
> I would also like to have some kind of validation system also as part
> of the settings interface. For example: If a setting can accept only
> ints, trying to set a string to that should be disabled, min and max
> values (range) for values of settings, etc.
>
> I googled and found that sysctl interface and the sysfs interfaces
> seem to be doing something similar. But I was not sure which to pick
> as the wikipedia pages were not as elaborate as I would like.
>
> So my question is: Is there a settings infrastructure provided by the
> linux kernel and is any filesystem (or any other kernel components)
> that make use of such a settings infrastrucutre ?
Yes, sysfs or debugfs is the right interface. You can have a look at e.g.
ext4 which handles quite some sysfs attributes in fs/ext4/super.c (look at
ext4_ktype and structures and functions referenced from there).
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Linux filesystem configuration infrastructure
@ 2014-08-04 15:00 ` Jan Kara
0 siblings, 0 replies; 8+ messages in thread
From: Jan Kara @ 2014-08-04 15:00 UTC (permalink / raw)
To: Sankar P; +Cc: kernelnewbies, linux-fsdevel
Hello,
On Mon 04-08-14 10:20:35, Sankar P wrote:
> I have a simple filesystem that I did for learning purpose
> https://github.com/psankar/simplefs
>
> Now, I would like to add a few settings to my filesystem (such as the
> number of blocks that should be allocated in an extent by default,
> maximum fragmentation score after which defrag should be automatically
> handled etc.) I would like to have the ability to not just set these
> settings, but export them to a file and restore these settings later.
> Is there some kind of a settings infrastructure code that is available
> in the linux kernel or should I be developing something specific to my
> filesystem ?
>
> I would also like to have some kind of validation system also as part
> of the settings interface. For example: If a setting can accept only
> ints, trying to set a string to that should be disabled, min and max
> values (range) for values of settings, etc.
>
> I googled and found that sysctl interface and the sysfs interfaces
> seem to be doing something similar. But I was not sure which to pick
> as the wikipedia pages were not as elaborate as I would like.
>
> So my question is: Is there a settings infrastructure provided by the
> linux kernel and is any filesystem (or any other kernel components)
> that make use of such a settings infrastrucutre ?
Yes, sysfs or debugfs is the right interface. You can have a look at e.g.
ext4 which handles quite some sysfs attributes in fs/ext4/super.c (look at
ext4_ktype and structures and functions referenced from there).
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 8+ messages in thread
* Linux filesystem configuration infrastructure
2014-08-04 4:50 ` Sankar P
@ 2014-08-04 15:15 ` Valdis.Kletnieks
-1 siblings, 0 replies; 8+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2014-08-04 15:15 UTC (permalink / raw)
To: kernelnewbies
On Mon, 04 Aug 2014 10:20:35 +0530, Sankar P said:
> Now, I would like to add a few settings to my filesystem (such as the
> number of blocks that should be allocated in an extent by default,
> maximum fragmentation score after which defrag should be automatically
> handled etc.) I would like to have the ability to not just set these
> settings, but export them to a file and restore these settings later.
See the source code for tune2fs, which sets the parameters for extN file
systems. The most noteworthy point is that the settings are saved *on the
filesystem*, so that it can be mounted and handled correctly from the start,
without waiting for further configuration (consider - what happens if the
"default number of blocks per extent" is 8, and you try to read the first 9
blocks of an extent written when the setting was a non-default 16, before
you've configured the setting)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140804/59e295cb/attachment.bin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Linux filesystem configuration infrastructure
@ 2014-08-04 15:15 ` Valdis.Kletnieks
0 siblings, 0 replies; 8+ messages in thread
From: Valdis.Kletnieks @ 2014-08-04 15:15 UTC (permalink / raw)
To: Sankar P; +Cc: linux-fsdevel, kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 891 bytes --]
On Mon, 04 Aug 2014 10:20:35 +0530, Sankar P said:
> Now, I would like to add a few settings to my filesystem (such as the
> number of blocks that should be allocated in an extent by default,
> maximum fragmentation score after which defrag should be automatically
> handled etc.) I would like to have the ability to not just set these
> settings, but export them to a file and restore these settings later.
See the source code for tune2fs, which sets the parameters for extN file
systems. The most noteworthy point is that the settings are saved *on the
filesystem*, so that it can be mounted and handled correctly from the start,
without waiting for further configuration (consider - what happens if the
"default number of blocks per extent" is 8, and you try to read the first 9
blocks of an extent written when the setting was a non-default 16, before
you've configured the setting)
[-- Attachment #1.2: Type: application/pgp-signature, Size: 848 bytes --]
[-- Attachment #2: Type: text/plain, Size: 169 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-08-04 15:56 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-04 4:50 Linux filesystem configuration infrastructure Sankar P
2014-08-04 4:50 ` Sankar P
2014-08-04 5:21 ` Greg KH
2014-08-04 5:21 ` Greg KH
2014-08-04 15:00 ` Jan Kara
2014-08-04 15:00 ` Jan Kara
2014-08-04 15:15 ` Valdis.Kletnieks at vt.edu
2014-08-04 15:15 ` Valdis.Kletnieks
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.