Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 377732
b: refs/heads/master
c: 1bb4b7f
h: refs/heads/master
v: v3
  • Loading branch information
David Howells committed Jun 19, 2013
1 parent 06f7fd5 commit 863ab09
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 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: 2144bc78d41fe31ba58ffdd48571a54d3ca6b5fe
refs/heads/master: 1bb4b7f98f361132ea322834515334d95b93c184
10 changes: 5 additions & 5 deletions trunk/fs/fscache/page.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static void fscache_release_retrieval_op(struct fscache_operation *_op)

_enter("{OP%x}", op->op.debug_id);

ASSERTCMP(op->n_pages, ==, 0);
ASSERTCMP(atomic_read(&op->n_pages), ==, 0);

fscache_hist(fscache_retrieval_histogram, op->start_time);
if (op->context)
Expand Down Expand Up @@ -316,7 +316,7 @@ static void fscache_do_cancel_retrieval(struct fscache_operation *_op)
struct fscache_retrieval *op =
container_of(_op, struct fscache_retrieval, op);

op->n_pages = 0;
atomic_set(&op->n_pages, 0);
}

/*
Expand Down Expand Up @@ -406,7 +406,7 @@ int __fscache_read_or_alloc_page(struct fscache_cookie *cookie,
_leave(" = -ENOMEM");
return -ENOMEM;
}
op->n_pages = 1;
atomic_set(&op->n_pages, 1);

spin_lock(&cookie->lock);

Expand Down Expand Up @@ -533,7 +533,7 @@ int __fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
op = fscache_alloc_retrieval(cookie, mapping, end_io_func, context);
if (!op)
return -ENOMEM;
op->n_pages = *nr_pages;
atomic_set(&op->n_pages, *nr_pages);

spin_lock(&cookie->lock);

Expand Down Expand Up @@ -643,7 +643,7 @@ int __fscache_alloc_page(struct fscache_cookie *cookie,
op = fscache_alloc_retrieval(cookie, page->mapping, NULL, NULL);
if (!op)
return -ENOMEM;
op->n_pages = 1;
atomic_set(&op->n_pages, 1);

spin_lock(&cookie->lock);

Expand Down
7 changes: 3 additions & 4 deletions trunk/include/linux/fscache-cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ struct fscache_retrieval {
void *context; /* netfs read context (pinned) */
struct list_head to_do; /* list of things to be done by the backend */
unsigned long start_time; /* time at which retrieval started */
unsigned n_pages; /* number of pages to be retrieved */
atomic_t n_pages; /* number of pages to be retrieved */
};

typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op,
Expand Down Expand Up @@ -195,15 +195,14 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op)
static inline void fscache_retrieval_complete(struct fscache_retrieval *op,
int n_pages)
{
op->n_pages -= n_pages;
if (op->n_pages <= 0)
atomic_sub(n_pages, &op->n_pages);
if (atomic_read(&op->n_pages) <= 0)
fscache_op_complete(&op->op, true);
}

/**
* fscache_put_retrieval - Drop a reference to a retrieval operation
* @op: The retrieval operation affected
* @n_pages: The number of pages to account for
*
* Drop a reference to a retrieval operation.
*/
Expand Down

0 comments on commit 863ab09

Please sign in to comment.