2015-08-11 13:32:55

by Swee Hua Law

[permalink] [raw]
Subject: [PATCH 0/3] staging: lustre: fix checkpatch problems in llite/lloop.c

Fix 3 checkpatch problems in drivers/staging/lustre/lustre/llite/lloop.c
[PATCH 1/3] staging: lustre: Do not init global to NULL
[PATCH 2/3] staging: lustre: Add blank line after variable declaration
[PATCH 3/3] staging: lustre: Remove the space before \n


2015-08-11 13:33:08

by Swee Hua Law

[permalink] [raw]
Subject: [PATCH 1/3] staging: lustre: Do not init global to NULL

Remove "= NULL" in global variable

Signed-off-by: Swee Hua Law <[email protected]>
---
drivers/staging/lustre/lustre/llite/lloop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c
index d614234..b643f11 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -162,7 +162,7 @@ static int max_loop = MAX_LOOP_DEFAULT;
static struct lloop_device *loop_dev;
static struct gendisk **disks;
static struct mutex lloop_mutex;
-static void *ll_iocontrol_magic = NULL;
+static void *ll_iocontrol_magic;

static loff_t get_loop_size(struct lloop_device *lo, struct file *file)
{
--
2.1.4

2015-08-11 13:33:20

by Swee Hua Law

[permalink] [raw]
Subject: [PATCH 2/3] staging: lustre: Add blank line after variable declaration

Add blank line after variable declaration

Signed-off-by: Swee Hua Law <[email protected]>
---
drivers/staging/lustre/lustre/llite/lloop.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c
index b643f11..de5eaa0 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -372,9 +372,11 @@ err:
static inline void loop_handle_bio(struct lloop_device *lo, struct bio *bio)
{
int ret;
+
ret = do_bio_lustrebacked(lo, bio);
while (bio) {
struct bio *tmp = bio->bi_next;
+
bio->bi_next = NULL;
bio_endio(bio);
bio = tmp;
@@ -427,6 +429,7 @@ static int loop_thread(void *data)
wait_event(lo->lo_bh_wait, loop_active(lo));
if (!atomic_read(&lo->lo_pending)) {
int exiting = 0;
+
spin_lock_irq(&lo->lo_lock);
exiting = (lo->lo_state == LLOOP_RUNDOWN);
spin_unlock_irq(&lo->lo_lock);
--
2.1.4

2015-08-11 13:33:36

by Swee Hua Law

[permalink] [raw]
Subject: [PATCH 3/3] staging: lustre: Remove the space before \n

Remove the extra space character right before \n in the string

Signed-off-by: Swee Hua Law <[email protected]>
---
drivers/staging/lustre/lustre/llite/lloop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c
index de5eaa0..ee28457 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -308,7 +308,7 @@ static unsigned int loop_get_bio(struct lloop_device *lo, struct bio **req)
rw = first->bi_rw;
bio = &lo->lo_bio;
while (*bio && (*bio)->bi_rw == rw) {
- CDEBUG(D_INFO, "bio sector %llu size %u count %u vcnt%u \n",
+ CDEBUG(D_INFO, "bio sector %llu size %u count %u vcnt%u\n",
(unsigned long long)(*bio)->bi_iter.bi_sector,
(*bio)->bi_iter.bi_size,
page_count, (*bio)->bi_vcnt);
--
2.1.4

2015-08-11 14:00:40

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 3/3] staging: lustre: Remove the space before \n

On Tue, 2015-08-11 at 21:32 +0800, Swee Hua Law wrote:
> Remove the extra space character right before \n in the string
[]
> diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c
[]
> @@ -308,7 +308,7 @@ static unsigned int loop_get_bio(struct lloop_device *lo, struct bio **req)
> rw = first->bi_rw;
> bio = &lo->lo_bio;
> while (*bio && (*bio)->bi_rw == rw) {
> - CDEBUG(D_INFO, "bio sector %llu size %u count %u vcnt%u \n",
> + CDEBUG(D_INFO, "bio sector %llu size %u count %u vcnt%u\n",

More likely the space is misplaced and it should be:
CDEBUG(D_INFO, "bio sector %llu size %u count %u vcnt %u\n"

2015-08-12 05:00:42

by Sudip Mukherjee

[permalink] [raw]
Subject: Re: [PATCH 2/3] staging: lustre: Add blank line after variable declaration

On Tue, Aug 11, 2015 at 09:32:30PM +0800, Swee Hua Law wrote:
> Add blank line after variable declaration
>
> Signed-off-by: Swee Hua Law <[email protected]>
> ---
> drivers/staging/lustre/lustre/llite/lloop.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c
> index b643f11..de5eaa0 100644
> --- a/drivers/staging/lustre/lustre/llite/lloop.c
> +++ b/drivers/staging/lustre/lustre/llite/lloop.c
> @@ -372,9 +372,11 @@ err:
> static inline void loop_handle_bio(struct lloop_device *lo, struct bio *bio)
> {
> int ret;
> +
> ret = do_bio_lustrebacked(lo, bio);
> while (bio) {
> struct bio *tmp = bio->bi_next;
> +
> bio->bi_next = NULL;
> bio_endio(bio);
This patch will not apply. I am not sure how your tree got
bio_endio(bio) but in the staging tree this line is bio_endio(bio, ret);

regards
sudip

2015-08-12 06:31:18

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 2/3] staging: lustre: Add blank line after variable declaration

On Wed, 2015-08-12 at 10:30 +0530, Sudip Mukherjee wrote:
> On Tue, Aug 11, 2015 at 09:32:30PM +0800, Swee Hua Law wrote:
> > Add blank line after variable declaration
[]
> > diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c
[]
> > @@ -372,9 +372,11 @@ err:
> > static inline void loop_handle_bio(struct lloop_device *lo, struct bio *bio)
> > {
> > int ret;
> > +
> > ret = do_bio_lustrebacked(lo, bio);
> > while (bio) {
> > struct bio *tmp = bio->bi_next;
> > +
> > bio->bi_next = NULL;
> > bio_endio(bio);
> This patch will not apply. I am not sure how your tree got
> bio_endio(bio) but in the staging tree this line is bio_endio(bio, ret);

And besides that, why do only this file/location?

There are several hundred possible in lustre.

Using:

$ git ls-files -- "drivers/staging/lustre/*.[ch]" | \
xargs ./scripts/checkpatch.pl -f --fix-inplace --types=line_spacing

would fix just about all of them.

$ git diff --shortstat drivers/staging/lustre/
172 files changed, 267 insertions(+), 316 deletions(-)