Skip to content

Commit 19b3102

Browse files
tititiou36teigland
authored andcommitted
fs: dlm: Simplify buffer size computation in dlm_create_debug_file()
Use sizeof(name) instead of the equivalent, but hard coded, DLM_LOCKSPACE_LEN + 8. This is less verbose and more future proof. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent 94f6f05 commit 19b3102

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

fs/dlm/debug_fs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
986986
/* format 2 */
987987

988988
memset(name, 0, sizeof(name));
989-
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_locks", ls->ls_name);
989+
snprintf(name, sizeof(name), "%s_locks", ls->ls_name);
990990

991991
ls->ls_debug_locks_dentry = debugfs_create_file(name,
992992
0644,
@@ -997,7 +997,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
997997
/* format 3 */
998998

999999
memset(name, 0, sizeof(name));
1000-
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_all", ls->ls_name);
1000+
snprintf(name, sizeof(name), "%s_all", ls->ls_name);
10011001

10021002
ls->ls_debug_all_dentry = debugfs_create_file(name,
10031003
S_IFREG | S_IRUGO,
@@ -1008,7 +1008,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
10081008
/* format 4 */
10091009

10101010
memset(name, 0, sizeof(name));
1011-
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_toss", ls->ls_name);
1011+
snprintf(name, sizeof(name), "%s_toss", ls->ls_name);
10121012

10131013
ls->ls_debug_toss_dentry = debugfs_create_file(name,
10141014
S_IFREG | S_IRUGO,
@@ -1017,7 +1017,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
10171017
&format4_fops);
10181018

10191019
memset(name, 0, sizeof(name));
1020-
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name);
1020+
snprintf(name, sizeof(name), "%s_waiters", ls->ls_name);
10211021

10221022
ls->ls_debug_waiters_dentry = debugfs_create_file(name,
10231023
0644,
@@ -1028,7 +1028,7 @@ void dlm_create_debug_file(struct dlm_ls *ls)
10281028
/* format 5 */
10291029

10301030
memset(name, 0, sizeof(name));
1031-
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_queued_asts", ls->ls_name);
1031+
snprintf(name, sizeof(name), "%s_queued_asts", ls->ls_name);
10321032

10331033
ls->ls_debug_queued_asts_dentry = debugfs_create_file(name,
10341034
0644,

0 commit comments

Comments
 (0)