Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 260341
b: refs/heads/master
c: d8de9ab
h: refs/heads/master
i:
  260339: 2fef757
v: v3
  • Loading branch information
Sage Weil committed Jul 26, 2011
1 parent 386d38b commit 3b7a003
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 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: 4cf9d544631c92809cb94ea680c71df56e9437aa
refs/heads/master: d8de9ab63a57326d21154c13c365f949f53ce8e1
22 changes: 19 additions & 3 deletions trunk/fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
want = CEPH_CAP_FILE_BUFFER;
ret = ceph_get_caps(ci, CEPH_CAP_FILE_WR, want, &got, endoff);
if (ret < 0)
goto out;
goto out_put;

dout("aio_write %p %llx.%llx %llu~%u got cap refs on %s\n",
inode, ceph_vinop(inode), pos, (unsigned)iov->iov_len,
Expand All @@ -726,16 +726,31 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
ret = ceph_sync_write(file, iov->iov_base, iov->iov_len,
&iocb->ki_pos);
} else {
ret = generic_file_aio_write(iocb, iov, nr_segs, pos);
/*
* buffered write; drop Fw early to avoid slow
* revocation if we get stuck on balance_dirty_pages
*/
int dirty;

spin_lock(&inode->i_lock);
dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR);
spin_unlock(&inode->i_lock);
ceph_put_cap_refs(ci, got);

ret = generic_file_aio_write(iocb, iov, nr_segs, pos);
if ((ret >= 0 || ret == -EIOCBQUEUED) &&
((file->f_flags & O_SYNC) || IS_SYNC(file->f_mapping->host)
|| ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_NEARFULL))) {
err = vfs_fsync_range(file, pos, pos + ret - 1, 1);
if (err < 0)
ret = err;
}

if (dirty)
__mark_inode_dirty(inode, dirty);
goto out;
}

if (ret >= 0) {
int dirty;
spin_lock(&inode->i_lock);
Expand All @@ -745,12 +760,13 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
__mark_inode_dirty(inode, dirty);
}

out:
out_put:
dout("aio_write %p %llx.%llx %llu~%u dropping cap refs on %s\n",
inode, ceph_vinop(inode), pos, (unsigned)iov->iov_len,
ceph_cap_string(got));
ceph_put_cap_refs(ci, got);

out:
if (ret == -EOLDSNAPC) {
dout("aio_write %p %llx.%llx %llu~%u got EOLDSNAPC, retrying\n",
inode, ceph_vinop(inode), pos, (unsigned)iov->iov_len);
Expand Down

0 comments on commit 3b7a003

Please sign in to comment.