All of lore.kernel.org
 help / color / mirror / Atom feed
* reiser4: Request for minor change in max_name_len_cde()
@ 2006-02-16 16:48 Peter Klotz
  2006-02-17 12:32 ` Vladimir V. Saveliev
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Klotz @ 2006-02-16 16:48 UTC (permalink / raw)
  To: reiserfs-list

The function max_name_len_cde() in reiser4/plugin/item/cde40.c in my 
opinion limits the file name length too strict.

One finds:

   return
       tree_by_inode(dir)->nplug->max_item_size() -
       sizeof(directory_entry_format) - sizeof(cde_item_format) -
       sizeof(cde_unit_header) - 2;

I think the -2 can be safely changed to -1 since the only extra byte 
that has to be taken into account is the terminating zero of the file 
name in case a longname key is encountered.

The maximum file name length in the original case is 3976 bytes if the 
filesystem uses 4096 byte blocks. In this case the node header of the 
node containing the cde40 item reports 1 byte of free space.

4096   block size
 -28   sizeof(node40_header)
 -38   sizeof(item_header40)
  -2   sizeof(cde_item_format)
 -26   sizeof(cde_unit_header)
 -24   sizeof(directory_entry_format)
  -1   terminating zero of file name
  -1   ?
-----
3976

I changed the -2 to -1 and recompiled the kernel. Then I was able to 
create a file with a 3977 byte name. In this case the node header 
reports 0 bytes of free space.

Best regards, Peter.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: reiser4: Request for minor change in max_name_len_cde()
  2006-02-16 16:48 reiser4: Request for minor change in max_name_len_cde() Peter Klotz
@ 2006-02-17 12:32 ` Vladimir V. Saveliev
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir V. Saveliev @ 2006-02-17 12:32 UTC (permalink / raw)
  To: Peter Klotz; +Cc: reiserfs-list

Hello

On Thu, 2006-02-16 at 17:48 +0100, Peter Klotz wrote:
> The function max_name_len_cde() in reiser4/plugin/item/cde40.c in my 
> opinion limits the file name length too strict.
> 
> One finds:
> 
>    return
>        tree_by_inode(dir)->nplug->max_item_size() -
>        sizeof(directory_entry_format) - sizeof(cde_item_format) -
>        sizeof(cde_unit_header) - 2;
> 
> I think the -2 can be safely changed to -1 since the only extra byte 
> that has to be taken into account is the terminating zero of the file 
> name in case a longname key is encountered.
> 
> The maximum file name length in the original case is 3976 bytes if the 
> filesystem uses 4096 byte blocks. In this case the node header of the 
> node containing the cde40 item reports 1 byte of free space.
> 
> 4096   block size
>  -28   sizeof(node40_header)
>  -38   sizeof(item_header40)
>   -2   sizeof(cde_item_format)
>  -26   sizeof(cde_unit_header)
>  -24   sizeof(directory_entry_format)
>   -1   terminating zero of file name
>   -1   ?
> -----
> 3976
> 
> I changed the -2 to -1 and recompiled the kernel. Then I was able to 
> create a file with a 3977 byte name. In this case the node header 
> reports 0 bytes of free space.
> 

Thanks, we will fix it

> Best regards, Peter.
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-17 12:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-16 16:48 reiser4: Request for minor change in max_name_len_cde() Peter Klotz
2006-02-17 12:32 ` Vladimir V. Saveliev

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.