Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264224
b: refs/heads/master
c: 2c8fc86
h: refs/heads/master
v: v3
  • Loading branch information
Borislav Petkov authored and David S. Miller committed Oct 3, 2011
1 parent edbdc5a commit b4b96ef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 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: 7fd21be75dce605e7cf273bd64b6d733d422fb04
refs/heads/master: 2c8fc867602e385fd2abe76da0b6bda8ed907547
7 changes: 6 additions & 1 deletion trunk/drivers/ide/ide-disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,12 @@ static int idedisk_prep_fn(struct request_queue *q, struct request *rq)
if (!(rq->cmd_flags & REQ_FLUSH))
return BLKPREP_OK;

cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);
if (rq->special) {
cmd = rq->special;
memset(cmd, 0, sizeof(*cmd));
} else {
cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);
}

/* FIXME: map struct ide_taskfile on rq->cmd[] */
BUG_ON(cmd == NULL);
Expand Down
24 changes: 8 additions & 16 deletions trunk/fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,13 +1036,11 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
* on error we return an unlocked page and the error value
* on success we return a locked page and 0
*/
static int prepare_uptodate_page(struct page *page, u64 pos,
bool force_uptodate)
static int prepare_uptodate_page(struct page *page, u64 pos)
{
int ret = 0;

if (((pos & (PAGE_CACHE_SIZE - 1)) || force_uptodate) &&
!PageUptodate(page)) {
if ((pos & (PAGE_CACHE_SIZE - 1)) && !PageUptodate(page)) {
ret = btrfs_readpage(NULL, page);
if (ret)
return ret;
Expand All @@ -1063,7 +1061,7 @@ static int prepare_uptodate_page(struct page *page, u64 pos,
static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
struct page **pages, size_t num_pages,
loff_t pos, unsigned long first_index,
size_t write_bytes, bool force_uptodate)
size_t write_bytes)
{
struct extent_state *cached_state = NULL;
int i;
Expand All @@ -1088,11 +1086,10 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
}

if (i == 0)
err = prepare_uptodate_page(pages[i], pos,
force_uptodate);
err = prepare_uptodate_page(pages[i], pos);
if (i == num_pages - 1)
err = prepare_uptodate_page(pages[i],
pos + write_bytes, false);
pos + write_bytes);
if (err) {
page_cache_release(pages[i]);
faili = i - 1;
Expand Down Expand Up @@ -1161,7 +1158,6 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
size_t num_written = 0;
int nrptrs;
int ret = 0;
bool force_page_uptodate = false;

nrptrs = min((iov_iter_count(i) + PAGE_CACHE_SIZE - 1) /
PAGE_CACHE_SIZE, PAGE_CACHE_SIZE /
Expand Down Expand Up @@ -1204,8 +1200,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
* contents of pages from loop to loop
*/
ret = prepare_pages(root, file, pages, num_pages,
pos, first_index, write_bytes,
force_page_uptodate);
pos, first_index, write_bytes);
if (ret) {
btrfs_delalloc_release_space(inode,
num_pages << PAGE_CACHE_SHIFT);
Expand All @@ -1222,15 +1217,12 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
if (copied < write_bytes)
nrptrs = 1;

if (copied == 0) {
force_page_uptodate = true;
if (copied == 0)
dirty_pages = 0;
} else {
force_page_uptodate = false;
else
dirty_pages = (copied + offset +
PAGE_CACHE_SIZE - 1) >>
PAGE_CACHE_SHIFT;
}

/*
* If we had a short copy we need to release the excess delaloc
Expand Down

0 comments on commit b4b96ef

Please sign in to comment.