Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74750
b: refs/heads/master
c: d1afb67
h: refs/heads/master
v: v3
  • Loading branch information
Lachlan McIlroy authored and Lachlan McIlroy committed Dec 10, 2007
1 parent 78724d4 commit 02b7ca5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 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: cd57e594adc624dd9ee4c0ded3949da21ec24b2f
refs/heads/master: d1afb678ce77b930334a8a640a05b8e68178a377
33 changes: 13 additions & 20 deletions trunk/fs/xfs/linux-2.6/xfs_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,15 +725,15 @@ xfs_buf_associate_memory(
{
int rval;
int i = 0;
size_t ptr;
size_t end, end_cur;
off_t offset;
unsigned long pageaddr;
unsigned long offset;
size_t buflen;
int page_count;

page_count = PAGE_CACHE_ALIGN(len) >> PAGE_CACHE_SHIFT;
offset = (off_t) mem - ((off_t)mem & PAGE_CACHE_MASK);
if (offset && (len > PAGE_CACHE_SIZE))
page_count++;
pageaddr = (unsigned long)mem & PAGE_CACHE_MASK;
offset = (unsigned long)mem - pageaddr;
buflen = PAGE_CACHE_ALIGN(len + offset);
page_count = buflen >> PAGE_CACHE_SHIFT;

/* Free any previous set of page pointers */
if (bp->b_pages)
Expand All @@ -747,22 +747,15 @@ xfs_buf_associate_memory(
return rval;

bp->b_offset = offset;
ptr = (size_t) mem & PAGE_CACHE_MASK;
end = PAGE_CACHE_ALIGN((size_t) mem + len);
end_cur = end;
/* set up first page */
bp->b_pages[0] = mem_to_page(mem);

ptr += PAGE_CACHE_SIZE;
bp->b_page_count = ++i;
while (ptr < end) {
bp->b_pages[i] = mem_to_page((void *)ptr);
bp->b_page_count = ++i;
ptr += PAGE_CACHE_SIZE;

for (i = 0; i < bp->b_page_count; i++) {
bp->b_pages[i] = mem_to_page((void *)pageaddr);
pageaddr += PAGE_CACHE_SIZE;
}
bp->b_locked = 0;

bp->b_count_desired = bp->b_buffer_length = len;
bp->b_count_desired = len;
bp->b_buffer_length = buflen;
bp->b_flags |= XBF_MAPPED;

return 0;
Expand Down

0 comments on commit 02b7ca5

Please sign in to comment.