Re: [Cluster-devel] [PATCH 00/79] fs: new accessors for inode->i_ctime

2023-06-21 Thread Steven Rostedt
On Wed, 21 Jun 2023 10:45:05 -0400
Jeff Layton  wrote:

> Most of this conversion was done via coccinelle, with a few of the more
> non-standard accesses done by hand. There should be no behavioral
> changes with this set. That will come later, as we convert individual
> filesystems to use multigrain timestamps.

BTW, Linus has suggested to me that whenever a conccinelle script is used,
it should be included in the change log.

-- Steve



Re: [Cluster-devel] [PATCH/RFC] java: add initial bindings

2022-07-08 Thread Steven Rostedt
On Mon, 20 Jun 2022 16:45:39 -0400
Alexander Aring  wrote:

Hi Alexander!


> This patch adds basic java bindings for libtracecmd. It currently
> supports very basic handling of parsing trace-cmd recorded trace files.
> There might of course additional improvements regarding swig bindings and
> the memory handling. E.g. in javas builtin iterator for-each handling
> everything will keep in memory. The license for the high-level java
> bindings jar file is LGPL-2.1 and is the same as libtracecmd.
> 
> The author of this patch created a java application that uses those java
> bindings to trace locks and represent them in graphical GANTT diagram,
> see [0].
> 
> You need to set the JAVA_HOME environment variable to let the Makefile know
> that it builds the java bindings. This is somehow standard in the java world
> as replacement for pkg-config or similar. There should no trace-cmd java
> dependency, the recommended way should be to provide a kind of trace-cmd-java
> package from your distribution containing the tracecmd.jar and
> libctracecmdjava.so. This package would have then a java dependency to
> e.g. OpenJDK, that I was using to test those bindings for.
> 
> The author is not a swig expert but it works as it currently is. Also
> the author did not hit issues because memory _yet_. Those are beginning
> experimental bindings and can be changed/improved in future.


Are you "the author"?

Could you rephrase this better? 

Like:

"There may be better ways to do this with swig, but this appears to work as
is, as there were no issues because of memory _yet_."

That is, please try to rewrite the change log without referring to yourself.

> 
> [0] https://gitlab.com/netcoder/dlm2slog2
> Signed-off-by: Alexander Aring 
> ---
>  .gitignore|   4 +
>  Makefile  |  60 ++-
>  java/Makefile |  39 +
>  java/TraceCmd.java| 236 +
>  java/TraceCmdEvent.java   | 277 ++
>  java/TraceCmdException.java   |  16 ++
>  java/TraceCmdField.java   | 104 +++
>  java/ctracecmdjava.i  | 180 +++
>  java/example/Makefile |   7 +
>  java/example/TraceCmdExample.java |  33 
>  10 files changed, 953 insertions(+), 3 deletions(-)
>  create mode 100644 java/Makefile
>  create mode 100644 java/TraceCmd.java
>  create mode 100644 java/TraceCmdEvent.java
>  create mode 100644 java/TraceCmdException.java
>  create mode 100644 java/TraceCmdField.java
>  create mode 100644 java/ctracecmdjava.i
>  create mode 100644 java/example/Makefile
>  create mode 100644 java/example/TraceCmdExample.java
> 

I'm not a swig nor Java expert, and will likely not even test this code.
But I'm happy to include it if it doesn't break anything that I do test.
But if anyone complains of breakage, I'll simply point them to you ;-)

Are you OK with that?

Hmm, I should add a MAINTAINERS file to add people that support different
portions of trace-cmd.

-- Steve



Re: [Cluster-devel] [PATCH v2 1/2] fs: warn about impending deprecation of mandatory locks

2021-08-20 Thread Steven Rostedt
On Fri, 20 Aug 2021 17:52:19 +0200
David Hildenbrand  wrote:

> > +static bool warned_mand;
> >   static inline bool may_mandlock(void)
> >   {
> > +   if (!warned_mand) {
> > +   warned_mand = true;
> > +   
> > pr_warn("==\n");
> > +   pr_warn("WARNING: the mand mount option is being deprecated 
> > and\n");
> > +   pr_warn(" will be removed in v5.15!\n");
> > +   
> > pr_warn("==\n");
> > +   }  
> 
> Is there a reason not to use pr_warn_once() ?

You would need a single call though, otherwise each pr_warn_once()
would have its own state that it warned once.

const char warning[] =
"==\n"
"WARNING: the mand mount option is being deprecated and\n"
" will be removed in v5.15!\n"
"==\n";

pr_warn_once(warning);

-- Steve



Re: [Cluster-devel] [PATCH v7] blktrace: Fix potentail deadlock between delete & sysfs ops

2017-09-20 Thread Steven Rostedt
On Wed, 20 Sep 2017 13:09:31 -0600
Jens Axboe  wrote:
> 
> I'll take it through my tree, and I'll prune some of that comment
> as well (which should be a commit message thing, not a code comment).
> 

Agreed, and thanks.

-- Steve




Re: [Cluster-devel] [PATCH v7] blktrace: Fix potentail deadlock between delete & sysfs ops

2017-09-20 Thread Steven Rostedt

Christoph,

Can you give an acked-by for this patch?

Jens,

You want to take this through your tree, or do you want me to?

If you want it, here's my:

Acked-by: Steven Rostedt (VMware) <rost...@goodmis.org>

-- Steve


On Wed, 20 Sep 2017 13:26:11 -0400
Waiman Long <long...@redhat.com> wrote:

> The lockdep code had reported the following unsafe locking scenario:
> 
>CPU0CPU1
>
>   lock(s_active#228);
>lock(>bd_mutex/1);
>lock(s_active#228);
>   lock(>bd_mutex);
> 
>  *** DEADLOCK ***
> 
> The deadlock may happen when one task (CPU1) is trying to delete a
> partition in a block device and another task (CPU0) is accessing
> tracing sysfs file (e.g. /sys/block/dm-1/trace/act_mask) in that
> partition.
> 
> The s_active isn't an actual lock. It is a reference count (kn->count)
> on the sysfs (kernfs) file. Removal of a sysfs file, however, require
> a wait until all the references are gone. The reference count is
> treated like a rwsem using lockdep instrumentation code.
> 
> The fact that a thread is in the sysfs callback method or in the
> ioctl call means there is a reference to the opended sysfs or device
> file. That should prevent the underlying block structure from being
> removed.
> 
> Instead of using bd_mutex in the block_device structure, a new
> blk_trace_mutex is now added to the request_queue structure to protect
> access to the blk_trace structure.
> 
> Suggested-by: Christoph Hellwig <h...@infradead.org>
> Signed-off-by: Waiman Long <long...@redhat.com>
> ---
>  v7:
>   - Add a new blk_trace_mutex in request_queue structure for blk_trace
> protection.
> 
>  v6:
>   - Add a second patch to rename the bd_fsfreeze_mutex to
> bd_fsfreeze_blktrace_mutex.
> 
>  v5:
>   - Overload the bd_fsfreeze_mutex in block_device structure for
> blktrace protection.
> 
>  v4:
>   - Use blktrace_mutex in blk_trace_ioctl() as well.
> 
>  v3:
>   - Use a global blktrace_mutex to serialize sysfs attribute accesses
> instead of the bd_mutex.
> 
>  v2:
>   - Use READ_ONCE() and smp_store_mb() to read and write bd_deleting.
>   - Check for signal in the mutex_trylock loops.
>   - Use usleep() instead of schedule() for RT tasks.
> 
>  block/blk-core.c|  3 +++
>  include/linux/blkdev.h  |  1 +
>  kernel/trace/blktrace.c | 24 ++--
>  3 files changed, 22 insertions(+), 6 deletions(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index aebe676..048be4a 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -854,6 +854,9 @@ struct request_queue *blk_alloc_queue_node(gfp_t 
> gfp_mask, int node_id)
>  
>   kobject_init(>kobj, _queue_ktype);
>  
> +#ifdef CONFIG_BLK_DEV_IO_TRACE
> + mutex_init(>blk_trace_mutex);
> +#endif
>   mutex_init(>sysfs_lock);
>   spin_lock_init(>__queue_lock);
>  
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 460294b..02fa42d 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -551,6 +551,7 @@ struct request_queue {
>   int node;
>  #ifdef CONFIG_BLK_DEV_IO_TRACE
>   struct blk_trace*blk_trace;
> + struct mutexblk_trace_mutex;
>  #endif
>   /*
>* for flush operations
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index 2a685b4..d5cef05 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -648,6 +648,18 @@ int blk_trace_startstop(struct request_queue *q, int 
> start)
>  }
>  EXPORT_SYMBOL_GPL(blk_trace_startstop);
>  
> +/*
> + * When reading or writing the blktrace sysfs files, the references to the
> + * opened sysfs or device files should prevent the underlying block device
> + * from being removed. So no further delete protection is really needed.
> + *
> + * Protection from multiple readers and writers accessing blktrace data
> + * concurrently is still required. The bd_mutex was used for this purpose.
> + * That could lead to deadlock with concurrent block device deletion and
> + * sysfs access. As a result, a new blk_trace_mutex is now added to be
> + * used solely by the blktrace code.
> + */
> +
>  /**
>   * blk_trace_ioctl: - handle the ioctls associated with tracing
>   * @bdev:the block device
> @@ -665,7 +677,7 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned 
> cmd, char __user *arg)
>   if (!q)
>   return -ENXIO;
>  
> - mutex_lock(>bd_mutex);
> + mutex_lock(>blk_trace_mute

Re: [Cluster-devel] [PATCH v6 1/2] blktrace: Fix potentail deadlock between delete & sysfs ops

2017-09-19 Thread Steven Rostedt
On Tue, 19 Sep 2017 13:41:35 -0700
Christoph Hellwig  wrote:

> Call it blk_trace mutex and move it right next to the blk_trace
> structure:
> 
> ifdef CONFIG_BLK_DEV_IO_TRACE
> struct blk_trace*blk_trace;
>   struct mutexblk_trace_mutex;
> #endif
> 
> which makes it completely obvious to any read what you are protecting
> with it.

As a 1000ft away bystander, this appears to be the most logical
solution.

-- Steve



Re: [Cluster-devel] [PATCH v6 0/2] blktrace: Fix deadlock problem

2017-09-18 Thread Steven Rostedt

Acked-by: Steven Rostedt (VMware) <rost...@goodmis.org>

for the series.

Jens, feel free to take this in your tree.

-- Steve


On Mon, 18 Sep 2017 14:53:49 -0400
Waiman Long <long...@redhat.com> wrote:

>  v6:
>   - Add a second patch to rename the bd_fsfreeze_mutex to
> bd_fsfreeze_blktrace_mutex.
> 
>  v5:
>   - Overload the bd_fsfreeze_mutex in block_device structure for
> blktrace protection.
> 
>  v4:
>   - Use blktrace_mutex in blk_trace_ioctl() as well.
> 
>  v3:
>   - Use a global blktrace_mutex to serialize sysfs attribute accesses
> instead of the bd_mutex.
> 
>  v2:
>   - Use READ_ONCE() and smp_store_mb() to read and write bd_deleting.
>   - Check for signal in the mutex_trylock loops.
>   - Use usleep() instead of schedule() for RT tasks.
> 
> This patchset fixes a potential blktrace deadlock problem between
> block device deletion and sysfs operations.
> 
> Waiman Long (2):
>   blktrace: Fix potentail deadlock between delete & sysfs ops
>   block_dev: Rename bd_fsfreeze_mutex
> 
>  fs/block_dev.c  | 14 +++---
>  fs/gfs2/ops_fstype.c|  6 +++---
>  fs/nilfs2/super.c   |  6 +++---
>  fs/super.c  |  6 +++---
>  include/linux/fs.h  |  5 +++--
>  kernel/trace/blktrace.c | 26 --
>  6 files changed, 39 insertions(+), 24 deletions(-)
> 



[Cluster-devel] [PATCH 6/8] dlm: Use seq_puts() instead of seq_printf() for constant strings

2014-11-05 Thread Steven Rostedt
From: Joe Perches j...@perches.com

Convert the seq_printf output with constant strings to seq_puts.

Link: 
http://lkml.kernel.org/p/b416b016f4a6e49115ba736cad6ea2709a8bc1c4.1412031505.git@perches.com

Cc: Christine Caulfield ccaul...@redhat.com
Cc: David Teigland teigl...@redhat.com
Cc: cluster-devel@redhat.com
Signed-off-by: Joe Perches j...@perches.com
Signed-off-by: Steven Rostedt rost...@goodmis.org
---
 fs/dlm/debug_fs.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 3bf460894088..eea64912c9c0 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -279,7 +279,7 @@ static void print_format3(struct dlm_rsb *r, struct 
seq_file *s)
print_name = 0;
}
 
-   seq_printf(s, %s, print_name ? str  : hex);
+   seq_puts(s, print_name ? str  : hex);
 
for (i = 0; i  r-res_length; i++) {
if (print_name)
@@ -353,7 +353,7 @@ static void print_format4(struct dlm_rsb *r, struct 
seq_file *s)
print_name = 0;
}
 
-   seq_printf(s, %s, print_name ? str  : hex);
+   seq_puts(s, print_name ? str  : hex);
 
for (i = 0; i  r-res_length; i++) {
if (print_name)
@@ -390,23 +390,21 @@ static int table_seq_show(struct seq_file *seq, void 
*iter_ptr)
break;
case 2:
if (ri-header) {
-   seq_printf(seq, id nodeid remid pid xid exflags 
-   flags sts grmode rqmode time_ms 
-   r_nodeid r_len r_name\n);
+   seq_puts(seq, id nodeid remid pid xid exflags flags 
sts grmode rqmode time_ms r_nodeid r_len r_name\n);
ri-header = 0;
}
print_format2(ri-rsb, seq);
break;
case 3:
if (ri-header) {
-   seq_printf(seq, version rsb 1.1 lvb 1.1 lkb 1.1\n);
+   seq_puts(seq, version rsb 1.1 lvb 1.1 lkb 1.1\n);
ri-header = 0;
}
print_format3(ri-rsb, seq);
break;
case 4:
if (ri-header) {
-   seq_printf(seq, version 4 rsb 2\n);
+   seq_puts(seq, version 4 rsb 2\n);
ri-header = 0;
}
print_format4(ri-rsb, seq);
-- 
2.1.1




[Cluster-devel] [PATCH 5/8] dlm: Remove seq_printf() return checks and use seq_has_overflowed()

2014-11-05 Thread Steven Rostedt
From: Joe Perches j...@perches.com

The seq_printf() return is going away soon and users of it should
check seq_has_overflowed() to see if the buffer is full and will
not accept any more data.

Convert functions returning int to void where seq_printf() is used.

Link: 
http://lkml.kernel.org/p/43590057bcb83846acbbcc1fe641f792b2fb7773.1412031505.git@perches.com
Link: http://lkml.kernel.org/r/20141029220107.939492...@goodmis.org

Acked-by: David Teigland teigl...@redhat.com
Cc: Christine Caulfield ccaul...@redhat.com
Cc: cluster-devel@redhat.com
Signed-off-by: Joe Perches j...@perches.com
Signed-off-by: Steven Rostedt rost...@goodmis.org
---
 fs/dlm/debug_fs.c | 251 +-
 1 file changed, 117 insertions(+), 134 deletions(-)

diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 1323c568e362..3bf460894088 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -48,8 +48,8 @@ static char *print_lockmode(int mode)
}
 }
 
-static int print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb,
- struct dlm_rsb *res)
+static void print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb,
+  struct dlm_rsb *res)
 {
seq_printf(s, %08x %s, lkb-lkb_id, print_lockmode(lkb-lkb_grmode));
 
@@ -68,21 +68,17 @@ static int print_format1_lock(struct seq_file *s, struct 
dlm_lkb *lkb,
if (lkb-lkb_wait_type)
seq_printf(s,  wait_type: %d, lkb-lkb_wait_type);
 
-   return seq_puts(s, \n);
+   seq_puts(s, \n);
 }
 
-static int print_format1(struct dlm_rsb *res, struct seq_file *s)
+static void print_format1(struct dlm_rsb *res, struct seq_file *s)
 {
struct dlm_lkb *lkb;
int i, lvblen = res-res_ls-ls_lvblen, recover_list, root_list;
-   int rv;
 
lock_rsb(res);
 
-   rv = seq_printf(s, \nResource %p Name (len=%d) \,
-   res, res-res_length);
-   if (rv)
-   goto out;
+   seq_printf(s, \nResource %p Name (len=%d) \, res, res-res_length);
 
for (i = 0; i  res-res_length; i++) {
if (isprint(res-res_name[i]))
@@ -92,17 +88,16 @@ static int print_format1(struct dlm_rsb *res, struct 
seq_file *s)
}
 
if (res-res_nodeid  0)
-   rv = seq_printf(s, \\nLocal Copy, Master is node %d\n,
-   res-res_nodeid);
+   seq_printf(s, \\nLocal Copy, Master is node %d\n,
+  res-res_nodeid);
else if (res-res_nodeid == 0)
-   rv = seq_puts(s, \\nMaster Copy\n);
+   seq_puts(s, \\nMaster Copy\n);
else if (res-res_nodeid == -1)
-   rv = seq_printf(s, \\nLooking up master (lkid %x)\n,
-   res-res_first_lkid);
+   seq_printf(s, \\nLooking up master (lkid %x)\n,
+  res-res_first_lkid);
else
-   rv = seq_printf(s, \\nInvalid master %d\n,
-   res-res_nodeid);
-   if (rv)
+   seq_printf(s, \\nInvalid master %d\n, res-res_nodeid);
+   if (seq_has_overflowed(s))
goto out;
 
/* Print the LVB: */
@@ -116,8 +111,8 @@ static int print_format1(struct dlm_rsb *res, struct 
seq_file *s)
}
if (rsb_flag(res, RSB_VALNOTVALID))
seq_puts(s,  (INVALID));
-   rv = seq_puts(s, \n);
-   if (rv)
+   seq_puts(s, \n);
+   if (seq_has_overflowed(s))
goto out;
}
 
@@ -125,32 +120,30 @@ static int print_format1(struct dlm_rsb *res, struct 
seq_file *s)
recover_list = !list_empty(res-res_recover_list);
 
if (root_list || recover_list) {
-   rv = seq_printf(s, Recovery: root %d recover %d flags %lx 
-   count %d\n, root_list, recover_list,
-   res-res_flags, res-res_recover_locks_count);
-   if (rv)
-   goto out;
+   seq_printf(s, Recovery: root %d recover %d flags %lx count 
%d\n,
+  root_list, recover_list,
+  res-res_flags, res-res_recover_locks_count);
}
 
/* Print the locks attached to this resource */
seq_puts(s, Granted Queue\n);
list_for_each_entry(lkb, res-res_grantqueue, lkb_statequeue) {
-   rv = print_format1_lock(s, lkb, res);
-   if (rv)
+   print_format1_lock(s, lkb, res);
+   if (seq_has_overflowed(s))
goto out;
}
 
seq_puts(s, Conversion Queue\n);
list_for_each_entry(lkb, res-res_convertqueue, lkb_statequeue) {
-   rv = print_format1_lock(s, lkb, res);
-   if (rv)
+   print_format1_lock(s, lkb, res);
+   if (seq_has_overflowed(s

Re: [Cluster-devel] [RFA][PATCH 5/8] dlm: Remove seq_printf() return checks and use seq_has_overflowed()

2014-11-04 Thread Steven Rostedt
On Wed, 29 Oct 2014 17:56:07 -0400
Steven Rostedt rost...@goodmis.org wrote:

 From: Joe Perches j...@perches.com
 
 [ REQUEST FOR ACKS ]

Can any of the DLM maintainers give me an Acked-by for this?

Thanks!

-- Steve

 
 The seq_printf() return is going away soon and users of it should
 check seq_has_overflowed() to see if the buffer is full and will
 not accept any more data.
 
 Convert functions returning int to void where seq_printf() is used.
 
 Link: 
 http://lkml.kernel.org/p/43590057bcb83846acbbcc1fe641f792b2fb7773.1412031505.git@perches.com
 
 Cc: Christine Caulfield ccaul...@redhat.com
 Cc: David Teigland teigl...@redhat.com
 Cc: cluster-devel@redhat.com
 Signed-off-by: Joe Perches j...@perches.com
 Signed-off-by: Steven Rostedt rost...@goodmis.org
 ---
  fs/dlm/debug_fs.c | 251 
 +-
  1 file changed, 117 insertions(+), 134 deletions(-)
 
 diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
 index 1323c568e362..3bf460894088 100644
 --- a/fs/dlm/debug_fs.c
 +++ b/fs/dlm/debug_fs.c
 @@ -48,8 +48,8 @@ static char *print_lockmode(int mode)
   }
  }
  
 -static int print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb,
 -   struct dlm_rsb *res)
 +static void print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb,
 +struct dlm_rsb *res)
  {
   seq_printf(s, %08x %s, lkb-lkb_id, print_lockmode(lkb-lkb_grmode));
  
 @@ -68,21 +68,17 @@ static int print_format1_lock(struct seq_file *s, struct 
 dlm_lkb *lkb,
   if (lkb-lkb_wait_type)
   seq_printf(s,  wait_type: %d, lkb-lkb_wait_type);
  
 - return seq_puts(s, \n);
 + seq_puts(s, \n);
  }
  
 -static int print_format1(struct dlm_rsb *res, struct seq_file *s)
 +static void print_format1(struct dlm_rsb *res, struct seq_file *s)
  {
   struct dlm_lkb *lkb;
   int i, lvblen = res-res_ls-ls_lvblen, recover_list, root_list;
 - int rv;
  
   lock_rsb(res);
  
 - rv = seq_printf(s, \nResource %p Name (len=%d) \,
 - res, res-res_length);
 - if (rv)
 - goto out;
 + seq_printf(s, \nResource %p Name (len=%d) \, res, res-res_length);
  
   for (i = 0; i  res-res_length; i++) {
   if (isprint(res-res_name[i]))
 @@ -92,17 +88,16 @@ static int print_format1(struct dlm_rsb *res, struct 
 seq_file *s)
   }
  
   if (res-res_nodeid  0)
 - rv = seq_printf(s, \\nLocal Copy, Master is node %d\n,
 - res-res_nodeid);
 + seq_printf(s, \\nLocal Copy, Master is node %d\n,
 +res-res_nodeid);
   else if (res-res_nodeid == 0)
 - rv = seq_puts(s, \\nMaster Copy\n);
 + seq_puts(s, \\nMaster Copy\n);
   else if (res-res_nodeid == -1)
 - rv = seq_printf(s, \\nLooking up master (lkid %x)\n,
 - res-res_first_lkid);
 + seq_printf(s, \\nLooking up master (lkid %x)\n,
 +res-res_first_lkid);
   else
 - rv = seq_printf(s, \\nInvalid master %d\n,
 - res-res_nodeid);
 - if (rv)
 + seq_printf(s, \\nInvalid master %d\n, res-res_nodeid);
 + if (seq_has_overflowed(s))
   goto out;
  
   /* Print the LVB: */
 @@ -116,8 +111,8 @@ static int print_format1(struct dlm_rsb *res, struct 
 seq_file *s)
   }
   if (rsb_flag(res, RSB_VALNOTVALID))
   seq_puts(s,  (INVALID));
 - rv = seq_puts(s, \n);
 - if (rv)
 + seq_puts(s, \n);
 + if (seq_has_overflowed(s))
   goto out;
   }
  
 @@ -125,32 +120,30 @@ static int print_format1(struct dlm_rsb *res, struct 
 seq_file *s)
   recover_list = !list_empty(res-res_recover_list);
  
   if (root_list || recover_list) {
 - rv = seq_printf(s, Recovery: root %d recover %d flags %lx 
 - count %d\n, root_list, recover_list,
 - res-res_flags, res-res_recover_locks_count);
 - if (rv)
 - goto out;
 + seq_printf(s, Recovery: root %d recover %d flags %lx count 
 %d\n,
 +root_list, recover_list,
 +res-res_flags, res-res_recover_locks_count);
   }
  
   /* Print the locks attached to this resource */
   seq_puts(s, Granted Queue\n);
   list_for_each_entry(lkb, res-res_grantqueue, lkb_statequeue) {
 - rv = print_format1_lock(s, lkb, res);
 - if (rv)
 + print_format1_lock(s, lkb, res);
 + if (seq_has_overflowed(s))
   goto out;
   }
  
   seq_puts(s, Conversion Queue\n);
   list_for_each_entry(lkb, res-res_convertqueue, lkb_statequeue) {
 - rv = print_format1_lock(s, lkb, res);
 - if (rv

Re: [Cluster-devel] [RFA][PATCH 6/8] dlm: Use seq_puts() instead of seq_printf() for constant strings

2014-11-04 Thread Steven Rostedt
On Wed, 29 Oct 2014 17:56:08 -0400
Steven Rostedt rost...@goodmis.org wrote:

 From: Joe Perches j...@perches.com
 
 [ REQUEST FOR ACKS ]

Can any of the DLM maintainers give me an Acked-by for this?

Thanks!

-- Steve

 
 Convert the seq_printf output with constant strings to seq_puts.
 
 Link: 
 http://lkml.kernel.org/p/b416b016f4a6e49115ba736cad6ea2709a8bc1c4.1412031505.git@perches.com
 
 Cc: Christine Caulfield ccaul...@redhat.com
 Cc: David Teigland teigl...@redhat.com
 Cc: cluster-devel@redhat.com
 Signed-off-by: Joe Perches j...@perches.com
 Signed-off-by: Steven Rostedt rost...@goodmis.org
 ---
  fs/dlm/debug_fs.c | 12 +---
  1 file changed, 5 insertions(+), 7 deletions(-)
 
 diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
 index 3bf460894088..eea64912c9c0 100644
 --- a/fs/dlm/debug_fs.c
 +++ b/fs/dlm/debug_fs.c
 @@ -279,7 +279,7 @@ static void print_format3(struct dlm_rsb *r, struct 
 seq_file *s)
   print_name = 0;
   }
  
 - seq_printf(s, %s, print_name ? str  : hex);
 + seq_puts(s, print_name ? str  : hex);
  
   for (i = 0; i  r-res_length; i++) {
   if (print_name)
 @@ -353,7 +353,7 @@ static void print_format4(struct dlm_rsb *r, struct 
 seq_file *s)
   print_name = 0;
   }
  
 - seq_printf(s, %s, print_name ? str  : hex);
 + seq_puts(s, print_name ? str  : hex);
  
   for (i = 0; i  r-res_length; i++) {
   if (print_name)
 @@ -390,23 +390,21 @@ static int table_seq_show(struct seq_file *seq, void 
 *iter_ptr)
   break;
   case 2:
   if (ri-header) {
 - seq_printf(seq, id nodeid remid pid xid exflags 
 - flags sts grmode rqmode time_ms 
 - r_nodeid r_len r_name\n);
 + seq_puts(seq, id nodeid remid pid xid exflags flags 
 sts grmode rqmode time_ms r_nodeid r_len r_name\n);
   ri-header = 0;
   }
   print_format2(ri-rsb, seq);
   break;
   case 3:
   if (ri-header) {
 - seq_printf(seq, version rsb 1.1 lvb 1.1 lkb 1.1\n);
 + seq_puts(seq, version rsb 1.1 lvb 1.1 lkb 1.1\n);
   ri-header = 0;
   }
   print_format3(ri-rsb, seq);
   break;
   case 4:
   if (ri-header) {
 - seq_printf(seq, version 4 rsb 2\n);
 + seq_puts(seq, version 4 rsb 2\n);
   ri-header = 0;
   }
   print_format4(ri-rsb, seq);



[Cluster-devel] [RFA][PATCH 5/8] dlm: Remove seq_printf() return checks and use seq_has_overflowed()

2014-10-29 Thread Steven Rostedt
From: Joe Perches j...@perches.com

[ REQUEST FOR ACKS ]

The seq_printf() return is going away soon and users of it should
check seq_has_overflowed() to see if the buffer is full and will
not accept any more data.

Convert functions returning int to void where seq_printf() is used.

Link: 
http://lkml.kernel.org/p/43590057bcb83846acbbcc1fe641f792b2fb7773.1412031505.git@perches.com

Cc: Christine Caulfield ccaul...@redhat.com
Cc: David Teigland teigl...@redhat.com
Cc: cluster-devel@redhat.com
Signed-off-by: Joe Perches j...@perches.com
Signed-off-by: Steven Rostedt rost...@goodmis.org
---
 fs/dlm/debug_fs.c | 251 +-
 1 file changed, 117 insertions(+), 134 deletions(-)

diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 1323c568e362..3bf460894088 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -48,8 +48,8 @@ static char *print_lockmode(int mode)
}
 }
 
-static int print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb,
- struct dlm_rsb *res)
+static void print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb,
+  struct dlm_rsb *res)
 {
seq_printf(s, %08x %s, lkb-lkb_id, print_lockmode(lkb-lkb_grmode));
 
@@ -68,21 +68,17 @@ static int print_format1_lock(struct seq_file *s, struct 
dlm_lkb *lkb,
if (lkb-lkb_wait_type)
seq_printf(s,  wait_type: %d, lkb-lkb_wait_type);
 
-   return seq_puts(s, \n);
+   seq_puts(s, \n);
 }
 
-static int print_format1(struct dlm_rsb *res, struct seq_file *s)
+static void print_format1(struct dlm_rsb *res, struct seq_file *s)
 {
struct dlm_lkb *lkb;
int i, lvblen = res-res_ls-ls_lvblen, recover_list, root_list;
-   int rv;
 
lock_rsb(res);
 
-   rv = seq_printf(s, \nResource %p Name (len=%d) \,
-   res, res-res_length);
-   if (rv)
-   goto out;
+   seq_printf(s, \nResource %p Name (len=%d) \, res, res-res_length);
 
for (i = 0; i  res-res_length; i++) {
if (isprint(res-res_name[i]))
@@ -92,17 +88,16 @@ static int print_format1(struct dlm_rsb *res, struct 
seq_file *s)
}
 
if (res-res_nodeid  0)
-   rv = seq_printf(s, \\nLocal Copy, Master is node %d\n,
-   res-res_nodeid);
+   seq_printf(s, \\nLocal Copy, Master is node %d\n,
+  res-res_nodeid);
else if (res-res_nodeid == 0)
-   rv = seq_puts(s, \\nMaster Copy\n);
+   seq_puts(s, \\nMaster Copy\n);
else if (res-res_nodeid == -1)
-   rv = seq_printf(s, \\nLooking up master (lkid %x)\n,
-   res-res_first_lkid);
+   seq_printf(s, \\nLooking up master (lkid %x)\n,
+  res-res_first_lkid);
else
-   rv = seq_printf(s, \\nInvalid master %d\n,
-   res-res_nodeid);
-   if (rv)
+   seq_printf(s, \\nInvalid master %d\n, res-res_nodeid);
+   if (seq_has_overflowed(s))
goto out;
 
/* Print the LVB: */
@@ -116,8 +111,8 @@ static int print_format1(struct dlm_rsb *res, struct 
seq_file *s)
}
if (rsb_flag(res, RSB_VALNOTVALID))
seq_puts(s,  (INVALID));
-   rv = seq_puts(s, \n);
-   if (rv)
+   seq_puts(s, \n);
+   if (seq_has_overflowed(s))
goto out;
}
 
@@ -125,32 +120,30 @@ static int print_format1(struct dlm_rsb *res, struct 
seq_file *s)
recover_list = !list_empty(res-res_recover_list);
 
if (root_list || recover_list) {
-   rv = seq_printf(s, Recovery: root %d recover %d flags %lx 
-   count %d\n, root_list, recover_list,
-   res-res_flags, res-res_recover_locks_count);
-   if (rv)
-   goto out;
+   seq_printf(s, Recovery: root %d recover %d flags %lx count 
%d\n,
+  root_list, recover_list,
+  res-res_flags, res-res_recover_locks_count);
}
 
/* Print the locks attached to this resource */
seq_puts(s, Granted Queue\n);
list_for_each_entry(lkb, res-res_grantqueue, lkb_statequeue) {
-   rv = print_format1_lock(s, lkb, res);
-   if (rv)
+   print_format1_lock(s, lkb, res);
+   if (seq_has_overflowed(s))
goto out;
}
 
seq_puts(s, Conversion Queue\n);
list_for_each_entry(lkb, res-res_convertqueue, lkb_statequeue) {
-   rv = print_format1_lock(s, lkb, res);
-   if (rv)
+   print_format1_lock(s, lkb, res);
+   if (seq_has_overflowed(s))
goto out;
}
 
seq_puts(s

Re: [Cluster-devel] [PATCH 0/7] seq_printf cleanups

2014-10-28 Thread Steven Rostedt
Joe,

If you haven't already done so, can you update checkpatch.pl to
complain if someone checks the return value of seq_printf(),
seq_puts(), or seq_putc().

It should state that those functions will soon be returning void.

Thanks!

-- Steve