Patchwork break out stats for posix open/mkdir

login
register
mail settings
Submitter Steve French
Date July 10, 2009, 2:22 a.m.
Message ID <524f69650907091922jbefd100x80adf57bdf6f178f@mail.gmail.com>
Download mbox | patch
Permalink /patch/29661/
State New
Headers show

Comments

Steve French - July 10, 2009, 2:22 a.m.
Trivial fix to break out the stats for posix open and mkdir from the
other (mkdir)
Jeff Layton - July 10, 2009, 10:53 a.m.
On Thu, 2009-07-09 at 21:22 -0500, Steve French wrote:
> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
> index 7f19fef..3cf0609 100644
> --- a/fs/cifs/cifs_debug.c
> +++ b/fs/cifs/cifs_debug.c
> @@ -261,6 +261,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
>                                         atomic_set(&tcon->num_reads, 0);
>                                         atomic_set(&tcon->num_oplock_brks, 0);
>                                         atomic_set(&tcon->num_opens, 0);
> +                                       atomic_set(&tcon->num_posixopens, 0);
> +                                       atomic_set(&tcon->num_posixmkdirs, 0);
>                                         atomic_set(&tcon->num_closes, 0);
>                                         atomic_set(&tcon->num_deletes, 0);
>                                         atomic_set(&tcon->num_mkdirs, 0);
> @@ -347,11 +349,15 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
>                                         atomic_read(&tcon->num_locks),
>                                         atomic_read(&tcon->num_hardlinks),
>                                         atomic_read(&tcon->num_symlinks));
> -                               seq_printf(m, "\nOpens: %d Closes: %d"
> +                               seq_printf(m, "\nOpens: %d Closes: %d "
>                                               "Deletes: %d",
>                                         atomic_read(&tcon->num_opens),
>                                         atomic_read(&tcon->num_closes),
>                                         atomic_read(&tcon->num_deletes));
> +                               seq_printf(m, "\nPosix Opens %d "
						^^^^^^^^^^^^^^^^^
				Shouldn't that be "\nPosix Opens: %d" ?
> +                                             "Posix Mkdirs: %d",
> +                                       atomic_read(&tcon->num_posixopens),
> +                                       atomic_read(&tcon->num_posixmkdirs));
>                                 seq_printf(m, "\nMkdirs: %d Rmdirs: %d",
>                                         atomic_read(&tcon->num_mkdirs),
>                                         atomic_read(&tcon->num_rmdirs));
> diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> index 63f6cdf..6084d63 100644
> --- a/fs/cifs/cifsglob.h
> +++ b/fs/cifs/cifsglob.h
> @@ -260,6 +260,8 @@ struct cifsTconInfo {
>         atomic_t num_closes;
>         atomic_t num_deletes;
>         atomic_t num_mkdirs;
> +       atomic_t num_posixopens;
> +       atomic_t num_posixmkdirs;
>         atomic_t num_rmdirs;
>         atomic_t num_renames;
>         atomic_t num_t2renames;
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index 922f5fe..1866bc2 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -1113,7 +1113,10 @@ PsxCreat:
>  psx_create_err:
>         cifs_buf_release(pSMB);
>  
> -       cifs_stats_inc(&tcon->num_mkdirs);
> +       if (posix_flags & SMB_O_DIRECTORY)
> +               cifs_stats_inc(&tcon->num_posixmkdirs);
> +       else
> +               cifs_stats_inc(&tcon->num_posixopens);
>  
>         if (rc == -EAGAIN)
>                 goto PsxCreat;
> 

Other than the minor nit above, looks fine to me.

Acked-by: Jeff Layton <jlayton@redhat.com>
Steve French - July 10, 2009, 3 p.m.
On Fri, Jul 10, 2009 at 5:53 AM, Jeff Layton<jlayton@redhat.com> wrote:
> Other than the minor nit above, looks fine to me.
>
> Acked-by: Jeff Layton <jlayton@redhat.com>

Thanks for checking the typo.

Patch

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 7f19fef..3cf0609 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -261,6 +261,8 @@  static ssize_t cifs_stats_proc_write(struct file *file,
 					atomic_set(&tcon->num_reads, 0);
 					atomic_set(&tcon->num_oplock_brks, 0);
 					atomic_set(&tcon->num_opens, 0);
+					atomic_set(&tcon->num_posixopens, 0);
+					atomic_set(&tcon->num_posixmkdirs, 0);
 					atomic_set(&tcon->num_closes, 0);
 					atomic_set(&tcon->num_deletes, 0);
 					atomic_set(&tcon->num_mkdirs, 0);
@@ -347,11 +349,15 @@  static int cifs_stats_proc_show(struct seq_file *m, void *v)
 					atomic_read(&tcon->num_locks),
 					atomic_read(&tcon->num_hardlinks),
 					atomic_read(&tcon->num_symlinks));
-				seq_printf(m, "\nOpens: %d Closes: %d"
+				seq_printf(m, "\nOpens: %d Closes: %d "
 					      "Deletes: %d",
 					atomic_read(&tcon->num_opens),
 					atomic_read(&tcon->num_closes),
 					atomic_read(&tcon->num_deletes));
+				seq_printf(m, "\nPosix Opens %d "
+					      "Posix Mkdirs: %d",
+					atomic_read(&tcon->num_posixopens),
+					atomic_read(&tcon->num_posixmkdirs));
 				seq_printf(m, "\nMkdirs: %d Rmdirs: %d",
 					atomic_read(&tcon->num_mkdirs),
 					atomic_read(&tcon->num_rmdirs));
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 63f6cdf..6084d63 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -260,6 +260,8 @@  struct cifsTconInfo {
 	atomic_t num_closes;
 	atomic_t num_deletes;
 	atomic_t num_mkdirs;
+	atomic_t num_posixopens;
+	atomic_t num_posixmkdirs;
 	atomic_t num_rmdirs;
 	atomic_t num_renames;
 	atomic_t num_t2renames;
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 922f5fe..1866bc2 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1113,7 +1113,10 @@  PsxCreat:
 psx_create_err:
 	cifs_buf_release(pSMB);
 
-	cifs_stats_inc(&tcon->num_mkdirs);
+	if (posix_flags & SMB_O_DIRECTORY)
+		cifs_stats_inc(&tcon->num_posixmkdirs);
+	else
+		cifs_stats_inc(&tcon->num_posixopens);
 
 	if (rc == -EAGAIN)
 		goto PsxCreat;