Skip to contentSkip to conversation

can I change NAME_MAX limit

DISCUSSION [email protected] 2 participants 2 messages May 7, 2019 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hi Guys,

I am running btrfs on a 4.4.178 kernel,  I want to support a longer file name, now the NAME_MAX is 255,  can I just increase the NAME_MAX macro and recompile the kernel to support longer file name ?  I guess I will break sth,  but I am not sure what part will be broken.

Thanks.

#1 lore raw
Quoted 4 lines · On Tue, May 07, 2019 at 05:48:47PM +0800, [email protected] wrote:

I am running btrfs on a 4.4.178 kernel,  I want to support a longer file name, now the NAME_MAX is 255,  can I just increase the NAME_MAX macro and recompile the kernel to support longer file name ?  I guess I will break sth,  but I am not sure what part will be broken.

NAME_MAX is system-wide and defined in limits.h. This is not btrfs specific, you'd need to recompile the whole userspace too and who knows what would break.

255 fits into a byte and I think some filesystems use that as maximum that can be stored in their metdata, ie. not possible to change without wider thanges.

Btrfs has space in btrfs_dir_item as it stores the name as 16bit number.