Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 190815
b: refs/heads/master
c: 5ec390e
h: refs/heads/master
i:
  190813: 00133ab
  190811: d03ed4a
  190807: d697490
  190799: 8be4469
  190783: 6abd9c2
v: v3
  • Loading branch information
Linus Torvalds committed May 13, 2010
1 parent 1b0979d commit 7d6eb99
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 164 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: 57d84906f0f3005d4d22e13a3f5102a16a7fc4a2
refs/heads/master: 5ec390e046039942d59ef2634b967b8b23fc57c2
114 changes: 2 additions & 112 deletions trunk/drivers/pci/setup-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,131 +838,21 @@ static void pci_bus_dump_resources(struct pci_bus *bus)
}
}

static int __init pci_bus_get_depth(struct pci_bus *bus)
{
int depth = 0;
struct pci_dev *dev;

list_for_each_entry(dev, &bus->devices, bus_list) {
int ret;
struct pci_bus *b = dev->subordinate;
if (!b)
continue;

ret = pci_bus_get_depth(b);
if (ret + 1 > depth)
depth = ret + 1;
}

return depth;
}
static int __init pci_get_max_depth(void)
{
int depth = 0;
struct pci_bus *bus;

list_for_each_entry(bus, &pci_root_buses, node) {
int ret;

ret = pci_bus_get_depth(bus);
if (ret > depth)
depth = ret;
}

return depth;
}

/*
* first try will not touch pci bridge res
* second and later try will clear small leaf bridge res
* will stop till to the max deepth if can not find good one
*/
void __init
pci_assign_unassigned_resources(void)
{
struct pci_bus *bus;
int tried_times = 0;
enum release_type rel_type = leaf_only;
struct resource_list_x head, *list;
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
IORESOURCE_PREFETCH;
unsigned long failed_type;
int max_depth = pci_get_max_depth();
int pci_try_num;

head.next = NULL;

pci_try_num = max_depth + 1;
printk(KERN_DEBUG "PCI: max bus depth: %d pci_try_num: %d\n",
max_depth, pci_try_num);

again:
/* Depth first, calculate sizes and alignments of all
subordinate buses. */
list_for_each_entry(bus, &pci_root_buses, node) {
pci_bus_size_bridges(bus);
}
/* Depth last, allocate resources and update the hardware. */
list_for_each_entry(bus, &pci_root_buses, node) {
__pci_bus_assign_resources(bus, &head);
}
tried_times++;

/* any device complain? */
if (!head.next)
goto enable_and_dump;
failed_type = 0;
for (list = head.next; list;) {
failed_type |= list->flags;
list = list->next;
}
/*
* io port are tight, don't try extra
* or if reach the limit, don't want to try more
*/
failed_type &= type_mask;
if ((failed_type == IORESOURCE_IO) || (tried_times >= pci_try_num)) {
free_failed_list(&head);
goto enable_and_dump;
}

printk(KERN_DEBUG "PCI: No. %d try to assign unassigned res\n",
tried_times + 1);

/* third times and later will not check if it is leaf */
if ((tried_times + 1) > 2)
rel_type = whole_subtree;

/*
* Try to release leaf bridge's resources that doesn't fit resource of
* child device under that bridge
*/
for (list = head.next; list;) {
bus = list->dev->bus;
pci_bus_release_bridge_resources(bus, list->flags & type_mask,
rel_type);
list = list->next;
}
/* restore size and flags */
for (list = head.next; list;) {
struct resource *res = list->res;

res->start = list->start;
res->end = list->end;
res->flags = list->flags;
if (list->dev->subordinate)
res->flags = 0;

list = list->next;
}
free_failed_list(&head);

goto again;

enable_and_dump:
/* Depth last, update the hardware. */
list_for_each_entry(bus, &pci_root_buses, node)
pci_bus_assign_resources(bus);
pci_enable_bridges(bus);
}

/* dump the resource on buses */
list_for_each_entry(bus, &pci_root_buses, node) {
Expand Down
4 changes: 4 additions & 0 deletions trunk/fs/cachefiles/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ static int cachefiles_check_cache_dir(struct cachefiles_cache *cache,
/*
* check the security details of the on-disk cache
* - must be called with security override in force
* - must return with a security override in force - even in the case of an
* error
*/
int cachefiles_determine_cache_security(struct cachefiles_cache *cache,
struct dentry *root,
Expand All @@ -99,6 +101,8 @@ int cachefiles_determine_cache_security(struct cachefiles_cache *cache,
* which create files */
ret = set_create_files_as(new, root->d_inode);
if (ret < 0) {
abort_creds(new);
cachefiles_begin_secure(cache, _saved_cred);
_leave(" = %d [cfa]", ret);
return ret;
}
Expand Down
6 changes: 0 additions & 6 deletions trunk/fs/ceph/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ static void writepages_finish(struct ceph_osd_request *req,
int i;
struct ceph_snap_context *snapc = req->r_snapc;
struct address_space *mapping = inode->i_mapping;
struct writeback_control *wbc = req->r_wbc;
__s32 rc = -EIO;
u64 bytes = 0;
struct ceph_client *client = ceph_inode_to_client(inode);
Expand Down Expand Up @@ -546,10 +545,6 @@ static void writepages_finish(struct ceph_osd_request *req,
clear_bdi_congested(&client->backing_dev_info,
BLK_RW_ASYNC);

if (i >= wrote) {
dout("inode %p skipping page %p\n", inode, page);
wbc->pages_skipped++;
}
ceph_put_snap_context((void *)page->private);
page->private = 0;
ClearPagePrivate(page);
Expand Down Expand Up @@ -799,7 +794,6 @@ static int ceph_writepages_start(struct address_space *mapping,
alloc_page_vec(client, req);
req->r_callback = writepages_finish;
req->r_inode = inode;
req->r_wbc = wbc;
}

/* note position of first page in pvec */
Expand Down
19 changes: 12 additions & 7 deletions trunk/fs/ceph/caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,8 @@ static int __ceph_is_any_caps(struct ceph_inode_info *ci)
}

/*
* Remove a cap. Take steps to deal with a racing iterate_session_caps.
*
* caller should hold i_lock.
* caller will not hold session s_mutex if called from destroy_inode.
*/
Expand All @@ -866,15 +868,10 @@ void __ceph_remove_cap(struct ceph_cap *cap)
struct ceph_mds_session *session = cap->session;
struct ceph_inode_info *ci = cap->ci;
struct ceph_mds_client *mdsc = &ceph_client(ci->vfs_inode.i_sb)->mdsc;
int removed = 0;

dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);

/* remove from inode list */
rb_erase(&cap->ci_node, &ci->i_caps);
cap->ci = NULL;
if (ci->i_auth_cap == cap)
ci->i_auth_cap = NULL;

/* remove from session list */
spin_lock(&session->s_cap_lock);
if (session->s_cap_iterator == cap) {
Expand All @@ -885,10 +882,18 @@ void __ceph_remove_cap(struct ceph_cap *cap)
list_del_init(&cap->session_caps);
session->s_nr_caps--;
cap->session = NULL;
removed = 1;
}
/* protect backpointer with s_cap_lock: see iterate_session_caps */
cap->ci = NULL;
spin_unlock(&session->s_cap_lock);

if (cap->session == NULL)
/* remove from inode list */
rb_erase(&cap->ci_node, &ci->i_caps);
if (ci->i_auth_cap == cap)
ci->i_auth_cap = NULL;

if (removed)
ceph_put_cap(cap);

if (!__ceph_is_any_caps(ci) && ci->i_snap_realm) {
Expand Down
4 changes: 4 additions & 0 deletions trunk/fs/ceph/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,10 @@ static int fill_inode(struct inode *inode,
__ceph_get_fmode(ci, cap_fmode);
spin_unlock(&inode->i_lock);
}
} else if (cap_fmode >= 0) {
pr_warning("mds issued no caps on %llx.%llx\n",
ceph_vinop(inode));
__ceph_get_fmode(ci, cap_fmode);
}

/* update delegation info? */
Expand Down
34 changes: 19 additions & 15 deletions trunk/fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,10 @@ static void cleanup_cap_releases(struct ceph_mds_session *session)
}

/*
* Helper to safely iterate over all caps associated with a session.
* Helper to safely iterate over all caps associated with a session, with
* special care taken to handle a racing __ceph_remove_cap().
*
* caller must hold session s_mutex
* Caller must hold session s_mutex.
*/
static int iterate_session_caps(struct ceph_mds_session *session,
int (*cb)(struct inode *, struct ceph_cap *,
Expand Down Expand Up @@ -2136,7 +2137,7 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds)
struct ceph_mds_session *session = NULL;
struct ceph_msg *reply;
struct rb_node *p;
int err;
int err = -ENOMEM;
struct ceph_pagelist *pagelist;

pr_info("reconnect to recovering mds%d\n", mds);
Expand Down Expand Up @@ -2185,7 +2186,7 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds)
goto fail;
err = iterate_session_caps(session, encode_caps_cb, pagelist);
if (err < 0)
goto out;
goto fail;

/*
* snaprealms. we provide mds with the ino, seq (version), and
Expand Down Expand Up @@ -2213,28 +2214,31 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds)
reply->nr_pages = calc_pages_for(0, pagelist->length);
ceph_con_send(&session->s_con, reply);

if (session) {
session->s_state = CEPH_MDS_SESSION_OPEN;
__wake_requests(mdsc, &session->s_waiting);
}
session->s_state = CEPH_MDS_SESSION_OPEN;
mutex_unlock(&session->s_mutex);

mutex_lock(&mdsc->mutex);
__wake_requests(mdsc, &session->s_waiting);
mutex_unlock(&mdsc->mutex);

ceph_put_mds_session(session);

out:
up_read(&mdsc->snap_rwsem);
if (session) {
mutex_unlock(&session->s_mutex);
ceph_put_mds_session(session);
}
mutex_lock(&mdsc->mutex);
return;

fail:
ceph_msg_put(reply);
up_read(&mdsc->snap_rwsem);
mutex_unlock(&session->s_mutex);
ceph_put_mds_session(session);
fail_nomsg:
ceph_pagelist_release(pagelist);
kfree(pagelist);
fail_nopagelist:
pr_err("ENOMEM preparing reconnect for mds%d\n", mds);
goto out;
pr_err("error %d preparing reconnect for mds%d\n", err, mds);
mutex_lock(&mdsc->mutex);
return;
}


Expand Down
17 changes: 15 additions & 2 deletions trunk/fs/ceph/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,14 @@ static void prepare_write_message(struct ceph_connection *con)
list_move_tail(&m->list_head, &con->out_sent);
}

m->hdr.seq = cpu_to_le64(++con->out_seq);
/*
* only assign outgoing seq # if we haven't sent this message
* yet. if it is requeued, resend with it's original seq.
*/
if (m->needs_out_seq) {
m->hdr.seq = cpu_to_le64(++con->out_seq);
m->needs_out_seq = false;
}

dout("prepare_write_message %p seq %lld type %d len %d+%d+%d %d pgs\n",
m, con->out_seq, le16_to_cpu(m->hdr.type),
Expand Down Expand Up @@ -1986,6 +1993,8 @@ void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg)

BUG_ON(msg->front.iov_len != le32_to_cpu(msg->hdr.front_len));

msg->needs_out_seq = true;

/* queue */
mutex_lock(&con->mutex);
BUG_ON(!list_empty(&msg->list_head));
Expand Down Expand Up @@ -2085,15 +2094,19 @@ struct ceph_msg *ceph_msg_new(int type, int front_len,
kref_init(&m->kref);
INIT_LIST_HEAD(&m->list_head);

m->hdr.tid = 0;
m->hdr.type = cpu_to_le16(type);
m->hdr.priority = cpu_to_le16(CEPH_MSG_PRIO_DEFAULT);
m->hdr.version = 0;
m->hdr.front_len = cpu_to_le32(front_len);
m->hdr.middle_len = 0;
m->hdr.data_len = cpu_to_le32(page_len);
m->hdr.data_off = cpu_to_le16(page_off);
m->hdr.priority = cpu_to_le16(CEPH_MSG_PRIO_DEFAULT);
m->hdr.reserved = 0;
m->footer.front_crc = 0;
m->footer.middle_crc = 0;
m->footer.data_crc = 0;
m->footer.flags = 0;
m->front_max = front_len;
m->front_is_vmalloc = false;
m->more_to_follow = false;
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/ceph/messenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ struct ceph_msg {
struct kref kref;
bool front_is_vmalloc;
bool more_to_follow;
bool needs_out_seq;
int front_max;

struct ceph_msgpool *pool;
Expand Down
Loading

0 comments on commit 7d6eb99

Please sign in to comment.