Skip to contentSkip to conversation

libceph: get rid of some unneeded function parameters

PATCH In review Alex Elder 2 participants 6 messages Feb 16, 2013

Subsystems (2)
lore
Share & tools
lore

Alex Elder

author
#0 lore raw

cover libceph: get rid of some unneeded function parameters

This series eliminates some unneeded parameters from functions in the osd client.

-Alex

[PATCH 1/4] ceph: kill ceph_osdc_writepages() "nofail" parameter [PATCH 2/4] ceph: kill ceph_osdc_writepages() "dosync" parameter [PATCH 3/4] ceph: kill ceph_osdc_writepages() "flags" parameter [PATCH 4/4] ceph: kill ceph_osdc_new_request() "num_reply"

author
#1 lore raw

PATCH 1/4 ceph: kill ceph_osdc_writepages() "nofail" parameter

There is only one caller of ceph_osdc_writepages(), and it always passes the value true as its "nofail" argument. Get rid of that argument and replace its use in ceph_osdc_writepages() with the constant value true.

This and a number of cleanup patches that follow resolve:

    http://tracker.ceph.com/issues/4126
---
 fs/ceph/addr.c                  |    2 +-
 include/linux/ceph/osd_client.h |    2 +-
 net/ceph/osd_client.c           |    6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)
fs/ceph/addr.c +0 -0
index 064d1a6..c7e401c 100644
@@ -493,7 +493,7 @@ static int writepage_nounlock(struct page *page,

struct writeback_control *wbc)
page_off, len, ci->i_truncate_seq, ci->i_truncate_size, &inode->i_mtime,
- &page, 1, 0, 0, true);
+ &page, 1, 0, 0);
if (err < 0) {
dout("writepage setting page/mapping error %d %p\n", err, page); SetPageError(page);

(quoted diff) +0 -0

b/include/linux/ceph/osd_client.h
index 82bf633..afcb255 100644

include/linux/ceph/osd_client.h +0 -0
@@ -275,7 +275,7 @@ extern int ceph_osdc_writepages(struct

ceph_osd_client *osdc,
u32 truncate_seq, u64 truncate_size, struct timespec *mtime, struct page **pages, int nr_pages,
- int flags, int do_sync, bool nofail);
+ int flags, int do_sync);

/* watch/notify events */
extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,

net/ceph/osd_client.c +0 -0
index d9d58bb..dd01b13 100644
@@ -1867,7 +1867,7 @@ int ceph_osdc_writepages(struct ceph_osd_client

*osdc, struct ceph_vino vino,
u32 truncate_seq, u64 truncate_size, struct timespec *mtime,
struct page **pages, int num_pages,
- int flags, int do_sync, bool nofail)
+ int flags, int do_sync)
{
struct ceph_osd_request *req;
int rc = 0;
@@ -1880,7 +1880,7 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
CEPH_OSD_FLAG_WRITE,
snapc, do_sync, truncate_seq, truncate_size, mtime,
- nofail, 1, page_align);
+ true, 1, page_align);
if (IS_ERR(req))
return PTR_ERR(req);

@@ -1889,7 +1889,7 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
dout("writepages %llu~%llu (%d pages)\n", off, len,
req->r_num_pages);

- rc = ceph_osdc_start_request(osdc, req, nofail);
+ rc = ceph_osdc_start_request(osdc, req, true);
if (!rc)
rc = ceph_osdc_wait_request(osdc, req);

Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/4 ceph: kill ceph_osdc_writepages() "dosync" parameter

In reply to Alex Elder

There is only one caller of ceph_osdc_writepages(), and it always passes 0 as its "dosync" argument. Get rid of that argument and replace its use in ceph_osdc_writepages() with 0.

---
 fs/ceph/addr.c                  |    2 +-
 include/linux/ceph/osd_client.h |    2 +-
 net/ceph/osd_client.c           |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
fs/ceph/addr.c +0 -0
index c7e401c..bef5528 100644
@@ -493,7 +493,7 @@ static int writepage_nounlock(struct page *page,

struct writeback_control *wbc)
page_off, len, ci->i_truncate_seq, ci->i_truncate_size, &inode->i_mtime,
- &page, 1, 0, 0);
+ &page, 1, 0);
if (err < 0) {
dout("writepage setting page/mapping error %d %p\n", err, page); SetPageError(page);

(quoted diff) +0 -0

b/include/linux/ceph/osd_client.h
index afcb255..7a63100 100644

include/linux/ceph/osd_client.h +0 -0
@@ -275,7 +275,7 @@ extern int ceph_osdc_writepages(struct

ceph_osd_client *osdc,
u32 truncate_seq, u64 truncate_size, struct timespec *mtime, struct page **pages, int nr_pages,
- int flags, int do_sync);
+ int flags);

/* watch/notify events */
extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,

net/ceph/osd_client.c +0 -0
index dd01b13..ac186b7 100644
@@ -1867,7 +1867,7 @@ int ceph_osdc_writepages(struct ceph_osd_client

*osdc, struct ceph_vino vino,
u32 truncate_seq, u64 truncate_size, struct timespec *mtime,
struct page **pages, int num_pages,
- int flags, int do_sync)
+ int flags)
{
struct ceph_osd_request *req;
int rc = 0;
@@ -1878,7 +1878,7 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
CEPH_OSD_OP_WRITE,
flags | CEPH_OSD_FLAG_ONDISK |
CEPH_OSD_FLAG_WRITE,
- snapc, do_sync,
+ snapc, 0,
truncate_seq, truncate_size, mtime, true, 1, page_align);
if (IS_ERR(req))

Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH 3/4 ceph: kill ceph_osdc_writepages() "flags" parameter

In reply to Alex Elder

There is only one caller of ceph_osdc_writepages(), and it always passes 0 as its "flags" argument. Get rid of that argument and replace its use in ceph_osdc_writepages() with 0.

---
 fs/ceph/addr.c                  |    3 +--
 include/linux/ceph/osd_client.h |    3 +--
 net/ceph/osd_client.c           |    6 ++----
 3 files changed, 4 insertions(+), 8 deletions(-)
fs/ceph/addr.c +0 -0
index bef5528..8d3240d 100644
@@ -492,8 +492,7 @@ static int writepage_nounlock(struct page *page,

struct writeback_control *wbc)
&ci->i_layout, snapc, page_off, len, ci->i_truncate_seq, ci->i_truncate_size,

-				   &inode->i_mtime,
-				   &page, 1, 0);
+				   &inode->i_mtime, &page, 1);

if (err < 0) {
dout("writepage setting page/mapping error %d %p\n", err, page); SetPageError(page);

(quoted diff) +0 -0

b/include/linux/ceph/osd_client.h
index 7a63100..6540e88 100644

include/linux/ceph/osd_client.h +0 -0
@@ -274,8 +274,7 @@ extern int ceph_osdc_writepages(struct

ceph_osd_client *osdc,
u64 off, u64 len,
u32 truncate_seq, u64 truncate_size, struct timespec *mtime,
- struct page **pages, int nr_pages,
- int flags);
+ struct page **pages, int nr_pages);

/* watch/notify events */
extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,

net/ceph/osd_client.c +0 -0
index ac186b7..d4e3812 100644
@@ -1866,8 +1866,7 @@ int ceph_osdc_writepages(struct ceph_osd_client

*osdc, struct ceph_vino vino,
u64 off, u64 len,
u32 truncate_seq, u64 truncate_size, struct timespec *mtime,
- struct page **pages, int num_pages,
- int flags)
+ struct page **pages, int num_pages)
{
struct ceph_osd_request *req;
int rc = 0;
@@ -1876,8 +1875,7 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
BUG_ON(vino.snap != CEPH_NOSNAP);
req = ceph_osdc_new_request(osdc, layout, vino, off, &len,
CEPH_OSD_OP_WRITE,
- flags | CEPH_OSD_FLAG_ONDISK |
- CEPH_OSD_FLAG_WRITE,
+ CEPH_OSD_FLAG_ONDISK | CEPH_OSD_FLAG_WRITE,
snapc, 0,
truncate_seq, truncate_size, mtime, true, 1, page_align);

Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH 4/4 ceph: kill ceph_osdc_new_request() "num_reply"

In reply to Alex Elder

The "num_reply" parameter to ceph_osdc_new_request() is never used inside that function, so get rid of it.

Note that ceph_sync_write() passes 2 for that argument, while all other callers pass 1. It doesn't matter, but perhaps someone should verify this doesn't indicate a problem.

---
 fs/ceph/addr.c                  |    4 ++--
 fs/ceph/file.c                  |    2 +-
 include/linux/ceph/osd_client.h |    3 +--
 net/ceph/osd_client.c           |    6 +++---
 4 files changed, 7 insertions(+), 8 deletions(-)
fs/ceph/addr.c +0 -0
index 8d3240d..fc61371 100644
@@ -315,7 +315,7 @@ static int start_read(struct inode *inode, struct

list_head *page_list, int max)
CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, NULL, 0,
ci->i_truncate_seq, ci->i_truncate_size,
- NULL, false, 1, 0);
+ NULL, false, 0);
if (IS_ERR(req))
return PTR_ERR(req);

@@ -837,7 +837,7 @@ get_more_pages:
snapc, do_sync, ci->i_truncate_seq, ci->i_truncate_size,
- &inode->i_mtime, true, 1, 0);
+ &inode->i_mtime, true, 0);

if (IS_ERR(req)) {
rc = PTR_ERR(req);

fs/ceph/file.c +1 -1
index a1e5b81..9c4325e 100644
@@ -541,7 +541,7 @@ more:
 				    ci->i_snap_realm->cached_context,
 				    do_sync,
 				    ci->i_truncate_seq, ci->i_truncate_size,
-				    &mtime, false, 2, page_align);
+				    &mtime, false, page_align);
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
(quoted diff) +0 -0

b/include/linux/ceph/osd_client.h
index 6540e88..5812802 100644

include/linux/ceph/osd_client.h +0 -0
@@ -234,8 +234,7 @@ extern struct ceph_osd_request

*ceph_osdc_new_request(struct ceph_osd_client *,
int do_sync, u32 truncate_seq, u64 truncate_size, struct timespec *mtime,

-				      bool use_mempool, int num_reply,
-				      int page_align);
+				      bool use_mempool, int page_align);

extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
struct ceph_osd_request *req);

net/ceph/osd_client.c +0 -0
index d4e3812..d3e7513 100644
@@ -393,7 +393,7 @@ struct ceph_osd_request

*ceph_osdc_new_request(struct ceph_osd_client *osdc,
u32 truncate_seq, u64 truncate_size, struct timespec *mtime,
- bool use_mempool, int num_reply,
+ bool use_mempool,
int page_align)
{
struct ceph_osd_req_op ops[2];
@@ -1837,7 +1837,7 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc,
req = ceph_osdc_new_request(osdc, layout, vino, off, plen,
CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, NULL, 0, truncate_seq, truncate_size, NULL,
- false, 1, page_align);
+ false, page_align);
if (IS_ERR(req))
return PTR_ERR(req);

@@ -1878,7 +1878,7 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
CEPH_OSD_FLAG_ONDISK | CEPH_OSD_FLAG_WRITE, snapc, 0,
truncate_seq, truncate_size, mtime,
- true, 1, page_align);
+ true, page_align);
if (IS_ERR(req))
return PTR_ERR(req);

Signature · 1 line
1.7.9.5
Reviewed-by on the v1 series
#5 lore raw
In reply to Alex Elder
Quoted 9 lines · Alex Elder

This series eliminates some unneeded parameters from functions in the osd client.

-Alex

[PATCH 1/4] ceph: kill ceph_osdc_writepages() "nofail" parameter [PATCH 2/4] ceph: kill ceph_osdc_writepages() "dosync" parameter [PATCH 3/4] ceph: kill ceph_osdc_writepages() "flags" parameter [PATCH 4/4] ceph: kill ceph_osdc_new_request() "num_reply"

These all look good.