aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-10-09 13:14:32 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-09 13:14:32 -0400
commit8dd9117cc7a021ced1c5cf177e2d44dd92b88617 (patch)
treecad990f58f9ec6d400226dda86718fc10781416e /net
parent16e310ae6ed352c4963b1f2413fcd88fa693eeda (diff)
parent547b1e81afe3119f7daf702cc03b158495535a25 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Pulled mainline in order to get the UAPI infrastructure already merged before I pull in David Howells's UAPI trees for networking. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/mon_client.c7
-rw-r--r--net/ceph/osd_client.c48
-rw-r--r--net/ceph/osdmap.c18
-rw-r--r--net/ceph/pagelist.c5
4 files changed, 50 insertions, 28 deletions
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 900ea0f043fc..812eb3b46c1f 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -637,7 +637,7 @@ bad:
637/* 637/*
638 * Do a synchronous pool op. 638 * Do a synchronous pool op.
639 */ 639 */
640int ceph_monc_do_poolop(struct ceph_mon_client *monc, u32 op, 640static int do_poolop(struct ceph_mon_client *monc, u32 op,
641 u32 pool, u64 snapid, 641 u32 pool, u64 snapid,
642 char *buf, int len) 642 char *buf, int len)
643{ 643{
@@ -687,7 +687,7 @@ out:
687int ceph_monc_create_snapid(struct ceph_mon_client *monc, 687int ceph_monc_create_snapid(struct ceph_mon_client *monc,
688 u32 pool, u64 *snapid) 688 u32 pool, u64 *snapid)
689{ 689{
690 return ceph_monc_do_poolop(monc, POOL_OP_CREATE_UNMANAGED_SNAP, 690 return do_poolop(monc, POOL_OP_CREATE_UNMANAGED_SNAP,
691 pool, 0, (char *)snapid, sizeof(*snapid)); 691 pool, 0, (char *)snapid, sizeof(*snapid));
692 692
693} 693}
@@ -696,7 +696,7 @@ EXPORT_SYMBOL(ceph_monc_create_snapid);
696int ceph_monc_delete_snapid(struct ceph_mon_client *monc, 696int ceph_monc_delete_snapid(struct ceph_mon_client *monc,
697 u32 pool, u64 snapid) 697 u32 pool, u64 snapid)
698{ 698{
699 return ceph_monc_do_poolop(monc, POOL_OP_CREATE_UNMANAGED_SNAP, 699 return do_poolop(monc, POOL_OP_CREATE_UNMANAGED_SNAP,
700 pool, snapid, 0, 0); 700 pool, snapid, 0, 0);
701 701
702} 702}
@@ -769,7 +769,6 @@ static int build_initial_monmap(struct ceph_mon_client *monc)
769 monc->monmap->mon_inst[i].name.num = cpu_to_le64(i); 769 monc->monmap->mon_inst[i].name.num = cpu_to_le64(i);
770 } 770 }
771 monc->monmap->num_mon = num_mon; 771 monc->monmap->num_mon = num_mon;
772 monc->have_fsid = false;
773 return 0; 772 return 0;
774} 773}
775 774
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 42119c05e82c..c1d756cc7448 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -52,7 +52,7 @@ static int op_has_extent(int op)
52 op == CEPH_OSD_OP_WRITE); 52 op == CEPH_OSD_OP_WRITE);
53} 53}
54 54
55void ceph_calc_raw_layout(struct ceph_osd_client *osdc, 55int ceph_calc_raw_layout(struct ceph_osd_client *osdc,
56 struct ceph_file_layout *layout, 56 struct ceph_file_layout *layout,
57 u64 snapid, 57 u64 snapid,
58 u64 off, u64 *plen, u64 *bno, 58 u64 off, u64 *plen, u64 *bno,
@@ -62,12 +62,15 @@ void ceph_calc_raw_layout(struct ceph_osd_client *osdc,
62 struct ceph_osd_request_head *reqhead = req->r_request->front.iov_base; 62 struct ceph_osd_request_head *reqhead = req->r_request->front.iov_base;
63 u64 orig_len = *plen; 63 u64 orig_len = *plen;
64 u64 objoff, objlen; /* extent in object */ 64 u64 objoff, objlen; /* extent in object */
65 int r;
65 66
66 reqhead->snapid = cpu_to_le64(snapid); 67 reqhead->snapid = cpu_to_le64(snapid);
67 68
68 /* object extent? */ 69 /* object extent? */
69 ceph_calc_file_object_mapping(layout, off, plen, bno, 70 r = ceph_calc_file_object_mapping(layout, off, plen, bno,
70 &objoff, &objlen); 71 &objoff, &objlen);
72 if (r < 0)
73 return r;
71 if (*plen < orig_len) 74 if (*plen < orig_len)
72 dout(" skipping last %llu, final file extent %llu~%llu\n", 75 dout(" skipping last %llu, final file extent %llu~%llu\n",
73 orig_len - *plen, off, *plen); 76 orig_len - *plen, off, *plen);
@@ -83,7 +86,7 @@ void ceph_calc_raw_layout(struct ceph_osd_client *osdc,
83 86
84 dout("calc_layout bno=%llx %llu~%llu (%d pages)\n", 87 dout("calc_layout bno=%llx %llu~%llu (%d pages)\n",
85 *bno, objoff, objlen, req->r_num_pages); 88 *bno, objoff, objlen, req->r_num_pages);
86 89 return 0;
87} 90}
88EXPORT_SYMBOL(ceph_calc_raw_layout); 91EXPORT_SYMBOL(ceph_calc_raw_layout);
89 92
@@ -112,20 +115,25 @@ EXPORT_SYMBOL(ceph_calc_raw_layout);
112 * 115 *
113 * fill osd op in request message. 116 * fill osd op in request message.
114 */ 117 */
115static void calc_layout(struct ceph_osd_client *osdc, 118static int calc_layout(struct ceph_osd_client *osdc,
116 struct ceph_vino vino, 119 struct ceph_vino vino,
117 struct ceph_file_layout *layout, 120 struct ceph_file_layout *layout,
118 u64 off, u64 *plen, 121 u64 off, u64 *plen,
119 struct ceph_osd_request *req, 122 struct ceph_osd_request *req,
120 struct ceph_osd_req_op *op) 123 struct ceph_osd_req_op *op)
121{ 124{
122 u64 bno; 125 u64 bno;
126 int r;
123 127
124 ceph_calc_raw_layout(osdc, layout, vino.snap, off, 128 r = ceph_calc_raw_layout(osdc, layout, vino.snap, off,
125 plen, &bno, req, op); 129 plen, &bno, req, op);
130 if (r < 0)
131 return r;
126 132
127 snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, bno); 133 snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, bno);
128 req->r_oid_len = strlen(req->r_oid); 134 req->r_oid_len = strlen(req->r_oid);
135
136 return r;
129} 137}
130 138
131/* 139/*
@@ -213,7 +221,6 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
213 kref_init(&req->r_kref); 221 kref_init(&req->r_kref);
214 init_completion(&req->r_completion); 222 init_completion(&req->r_completion);
215 init_completion(&req->r_safe_completion); 223 init_completion(&req->r_safe_completion);
216 rb_init_node(&req->r_node);
217 INIT_LIST_HEAD(&req->r_unsafe_item); 224 INIT_LIST_HEAD(&req->r_unsafe_item);
218 INIT_LIST_HEAD(&req->r_linger_item); 225 INIT_LIST_HEAD(&req->r_linger_item);
219 INIT_LIST_HEAD(&req->r_linger_osd); 226 INIT_LIST_HEAD(&req->r_linger_osd);
@@ -456,6 +463,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
456{ 463{
457 struct ceph_osd_req_op ops[3]; 464 struct ceph_osd_req_op ops[3];
458 struct ceph_osd_request *req; 465 struct ceph_osd_request *req;
466 int r;
459 467
460 ops[0].op = opcode; 468 ops[0].op = opcode;
461 ops[0].extent.truncate_seq = truncate_seq; 469 ops[0].extent.truncate_seq = truncate_seq;
@@ -474,10 +482,12 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
474 use_mempool, 482 use_mempool,
475 GFP_NOFS, NULL, NULL); 483 GFP_NOFS, NULL, NULL);
476 if (!req) 484 if (!req)
477 return NULL; 485 return ERR_PTR(-ENOMEM);
478 486
479 /* calculate max write size */ 487 /* calculate max write size */
480 calc_layout(osdc, vino, layout, off, plen, req, ops); 488 r = calc_layout(osdc, vino, layout, off, plen, req, ops);
489 if (r < 0)
490 return ERR_PTR(r);
481 req->r_file_layout = *layout; /* keep a copy */ 491 req->r_file_layout = *layout; /* keep a copy */
482 492
483 /* in case it differs from natural (file) alignment that 493 /* in case it differs from natural (file) alignment that
@@ -1920,8 +1930,8 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc,
1920 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, 1930 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ,
1921 NULL, 0, truncate_seq, truncate_size, NULL, 1931 NULL, 0, truncate_seq, truncate_size, NULL,
1922 false, 1, page_align); 1932 false, 1, page_align);
1923 if (!req) 1933 if (IS_ERR(req))
1924 return -ENOMEM; 1934 return PTR_ERR(req);
1925 1935
1926 /* it may be a short read due to an object boundary */ 1936 /* it may be a short read due to an object boundary */
1927 req->r_pages = pages; 1937 req->r_pages = pages;
@@ -1963,8 +1973,8 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
1963 snapc, do_sync, 1973 snapc, do_sync,
1964 truncate_seq, truncate_size, mtime, 1974 truncate_seq, truncate_size, mtime,
1965 nofail, 1, page_align); 1975 nofail, 1, page_align);
1966 if (!req) 1976 if (IS_ERR(req))
1967 return -ENOMEM; 1977 return PTR_ERR(req);
1968 1978
1969 /* it may be a short write due to an object boundary */ 1979 /* it may be a short write due to an object boundary */
1970 req->r_pages = pages; 1980 req->r_pages = pages;
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index 3124b71a8883..5433fb0eb3c6 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -984,7 +984,7 @@ bad:
984 * for now, we write only a single su, until we can 984 * for now, we write only a single su, until we can
985 * pass a stride back to the caller. 985 * pass a stride back to the caller.
986 */ 986 */
987void ceph_calc_file_object_mapping(struct ceph_file_layout *layout, 987int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
988 u64 off, u64 *plen, 988 u64 off, u64 *plen,
989 u64 *ono, 989 u64 *ono,
990 u64 *oxoff, u64 *oxlen) 990 u64 *oxoff, u64 *oxlen)
@@ -998,11 +998,17 @@ void ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
998 998
999 dout("mapping %llu~%llu osize %u fl_su %u\n", off, *plen, 999 dout("mapping %llu~%llu osize %u fl_su %u\n", off, *plen,
1000 osize, su); 1000 osize, su);
1001 if (su == 0 || sc == 0)
1002 goto invalid;
1001 su_per_object = osize / su; 1003 su_per_object = osize / su;
1004 if (su_per_object == 0)
1005 goto invalid;
1002 dout("osize %u / su %u = su_per_object %u\n", osize, su, 1006 dout("osize %u / su %u = su_per_object %u\n", osize, su,
1003 su_per_object); 1007 su_per_object);
1004 1008
1005 BUG_ON((su & ~PAGE_MASK) != 0); 1009 if ((su & ~PAGE_MASK) != 0)
1010 goto invalid;
1011
1006 /* bl = *off / su; */ 1012 /* bl = *off / su; */
1007 t = off; 1013 t = off;
1008 do_div(t, su); 1014 do_div(t, su);
@@ -1030,6 +1036,14 @@ void ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
1030 *plen = *oxlen; 1036 *plen = *oxlen;
1031 1037
1032 dout(" obj extent %llu~%llu\n", *oxoff, *oxlen); 1038 dout(" obj extent %llu~%llu\n", *oxoff, *oxlen);
1039 return 0;
1040
1041invalid:
1042 dout(" invalid layout\n");
1043 *ono = 0;
1044 *oxoff = 0;
1045 *oxlen = 0;
1046 return -EINVAL;
1033} 1047}
1034EXPORT_SYMBOL(ceph_calc_file_object_mapping); 1048EXPORT_SYMBOL(ceph_calc_file_object_mapping);
1035 1049
diff --git a/net/ceph/pagelist.c b/net/ceph/pagelist.c
index 665cd23020ff..92866bebb65f 100644
--- a/net/ceph/pagelist.c
+++ b/net/ceph/pagelist.c
@@ -1,4 +1,3 @@
1
2#include <linux/module.h> 1#include <linux/module.h>
3#include <linux/gfp.h> 2#include <linux/gfp.h>
4#include <linux/pagemap.h> 3#include <linux/pagemap.h>
@@ -134,8 +133,8 @@ int ceph_pagelist_truncate(struct ceph_pagelist *pl,
134 ceph_pagelist_unmap_tail(pl); 133 ceph_pagelist_unmap_tail(pl);
135 while (pl->head.prev != c->page_lru) { 134 while (pl->head.prev != c->page_lru) {
136 page = list_entry(pl->head.prev, struct page, lru); 135 page = list_entry(pl->head.prev, struct page, lru);
137 list_del(&page->lru); /* remove from pagelist */ 136 /* move from pagelist to reserve */
138 list_add_tail(&page->lru, &pl->free_list); /* add to reserve */ 137 list_move_tail(&page->lru, &pl->free_list);
139 ++pl->num_pages_free; 138 ++pl->num_pages_free;
140 } 139 }
141 pl->room = c->room; 140 pl->room = c->room;