Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188594
b: refs/heads/master
c: 6b80518
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed Oct 27, 2009
1 parent 4888ed0 commit 567cfca
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 75 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e53c2fe075feda1fd4f009956ac026dc24c3a199
refs/heads/master: 6b8051855d983db8480ff1ea1b02ef2b49203c22
4 changes: 2 additions & 2 deletions trunk/fs/ceph/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,8 @@ static int ceph_writepages_start(struct address_space *mapping,
pr_warning("writepage_start %p on forced umount\n", inode);
return -EIO; /* we're in a forced umount, don't write! */
}
if (client->mount_args.wsize && client->mount_args.wsize < wsize)
wsize = client->mount_args.wsize;
if (client->mount_args->wsize && client->mount_args->wsize < wsize)
wsize = client->mount_args->wsize;
if (wsize < PAGE_CACHE_SIZE)
wsize = PAGE_CACHE_SIZE;
max_pages_ever = wsize >> PAGE_CACHE_SHIFT;
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/ceph/caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static void put_cap(struct ceph_cap *cap,
* lots of free/alloc churn.
*/
if (caps_avail_count >= caps_reserve_count +
ceph_client(cap->ci->vfs_inode.i_sb)->mount_args.max_readdir) {
ceph_client(cap->ci->vfs_inode.i_sb)->mount_args->max_readdir) {
caps_total_count--;
kmem_cache_free(ceph_cap_cachep, cap);
} else {
Expand Down Expand Up @@ -388,7 +388,7 @@ static void __insert_cap_node(struct ceph_inode_info *ci,
static void __cap_set_timeouts(struct ceph_mds_client *mdsc,
struct ceph_inode_info *ci)
{
struct ceph_mount_args *ma = &mdsc->client->mount_args;
struct ceph_mount_args *ma = mdsc->client->mount_args;

ci->i_hold_caps_min = round_jiffies(jiffies +
ma->caps_wanted_delay_min * HZ);
Expand Down
7 changes: 4 additions & 3 deletions trunk/fs/ceph/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir)
int err;
u32 ftype;
struct ceph_mds_reply_info_parsed *rinfo;
const int max_entries = client->mount_args.max_readdir;
const int max_entries = client->mount_args->max_readdir;

dout("readdir %p filp %p frag %u off %u\n", inode, filp, frag, off);
if (fi->at_end)
Expand Down Expand Up @@ -479,7 +479,8 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,
/* .snap dir? */
if (err == -ENOENT &&
ceph_vino(parent).ino != CEPH_INO_ROOT && /* no .snap in root dir */
strcmp(dentry->d_name.name, client->mount_args.snapdir_name) == 0) {
strcmp(dentry->d_name.name,
client->mount_args->snapdir_name) == 0) {
struct inode *inode = ceph_get_snapdir(parent);
dout("ENOENT on snapdir %p '%.*s', linking to snapdir %p\n",
dentry, dentry->d_name.len, dentry->d_name.name, inode);
Expand Down Expand Up @@ -550,7 +551,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
spin_lock(&dir->i_lock);
dout(" dir %p flags are %d\n", dir, ci->i_ceph_flags);
if (strncmp(dentry->d_name.name,
client->mount_args.snapdir_name,
client->mount_args->snapdir_name,
dentry->d_name.len) &&
(ci->i_ceph_flags & CEPH_I_COMPLETE) &&
(__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) {
Expand Down
6 changes: 3 additions & 3 deletions trunk/fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ static int add_cap_releases(struct ceph_mds_client *mdsc,
int err = -ENOMEM;

if (extra < 0)
extra = mdsc->client->mount_args.cap_release_safety;
extra = mdsc->client->mount_args->cap_release_safety;

spin_lock(&session->s_cap_lock);

Expand Down Expand Up @@ -2601,7 +2601,7 @@ static void wait_requests(struct ceph_mds_client *mdsc)
mutex_unlock(&mdsc->mutex);
dout("wait_requests waiting for requests\n");
wait_for_completion_timeout(&mdsc->safe_umount_waiters,
client->mount_args.mount_timeout * HZ);
client->mount_args->mount_timeout * HZ);
mutex_lock(&mdsc->mutex);

/* tear down remaining requests */
Expand Down Expand Up @@ -2693,7 +2693,7 @@ void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc)
int i;
int n;
struct ceph_client *client = mdsc->client;
unsigned long started, timeout = client->mount_args.mount_timeout * HZ;
unsigned long started, timeout = client->mount_args->mount_timeout * HZ;

dout("close_sessions\n");

Expand Down
38 changes: 38 additions & 0 deletions trunk/fs/ceph/mon_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,40 @@ static void delayed_work(struct work_struct *work)
mutex_unlock(&monc->mutex);
}

/*
* On startup, we build a temporary monmap populated with the IPs
* provided by mount(2).
*/
static int build_initial_monmap(struct ceph_mon_client *monc)
{
struct ceph_mount_args *args = monc->client->mount_args;
struct ceph_entity_addr *mon_addr = args->mon_addr;
int num_mon = args->num_mon;
int i;

/* build initial monmap */
monc->monmap = kzalloc(sizeof(*monc->monmap) +
num_mon*sizeof(monc->monmap->mon_inst[0]),
GFP_KERNEL);
if (!monc->monmap)
return -ENOMEM;
for (i = 0; i < num_mon; i++) {
monc->monmap->mon_inst[i].addr = mon_addr[i];
monc->monmap->mon_inst[i].addr.erank = 0;
monc->monmap->mon_inst[i].addr.nonce = 0;
monc->monmap->mon_inst[i].name.type =
CEPH_ENTITY_TYPE_MON;
monc->monmap->mon_inst[i].name.num = cpu_to_le64(i);
}
monc->monmap->num_mon = num_mon;

/* release addr memory */
kfree(args->mon_addr);
args->mon_addr = NULL;
args->num_mon = 0;
return 0;
}

int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
{
int err = 0;
Expand All @@ -537,6 +571,10 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
monc->monmap = NULL;
mutex_init(&monc->mutex);

err = build_initial_monmap(monc);
if (err)
goto out;

monc->con = NULL;

/* msg pools */
Expand Down
6 changes: 3 additions & 3 deletions trunk/fs/ceph/osd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ static void register_request(struct ceph_osd_client *osdc,
osdc->num_requests++;

req->r_timeout_stamp =
jiffies + osdc->client->mount_args.osd_timeout*HZ;
jiffies + osdc->client->mount_args->osd_timeout*HZ;

if (osdc->num_requests == 1) {
osdc->timeout_tid = req->r_tid;
Expand Down Expand Up @@ -609,7 +609,7 @@ static int __send_request(struct ceph_osd_client *osdc,
reqhead->flags |= cpu_to_le32(req->r_flags); /* e.g., RETRY */
reqhead->reassert_version = req->r_reassert_version;

req->r_timeout_stamp = jiffies+osdc->client->mount_args.osd_timeout*HZ;
req->r_timeout_stamp = jiffies+osdc->client->mount_args->osd_timeout*HZ;

ceph_msg_get(req->r_request); /* send consumes a ref */
ceph_con_send(&req->r_osd->o_con, req->r_request);
Expand All @@ -632,7 +632,7 @@ static void handle_timeout(struct work_struct *work)
container_of(work, struct ceph_osd_client, timeout_work.work);
struct ceph_osd_request *req;
struct ceph_osd *osd;
unsigned long timeout = osdc->client->mount_args.osd_timeout * HZ;
unsigned long timeout = osdc->client->mount_args->osd_timeout * HZ;
unsigned long next_timeout = timeout + jiffies;
struct rb_node *p;

Expand Down
Loading

0 comments on commit 567cfca

Please sign in to comment.