X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fllite%2Frw24.c;h=df040c5f9fdaa804249cd30d9a1039352d3b8eb3;hb=95d394d59bbccbc92af076c985fd664719f8fe12;hp=8a3099f1fffc8104bf41dfc83aaa1fcecaddda8a;hpb=bd1b99d7caa6ab2b7c771524af9178a3da69eeab;p=fs%2Flustre-release.git diff --git a/lustre/llite/rw24.c b/lustre/llite/rw24.c index 8a3099f..df040c5 100644 --- a/lustre/llite/rw24.c +++ b/lustre/llite/rw24.c @@ -49,49 +49,6 @@ #include "llite_internal.h" #include -static int ll_writepage_24(struct page *page) -{ - struct inode *inode = page->mapping->host; - struct obd_export *exp; - struct ll_async_page *llap; - int rc = 0; - ENTRY; - - LASSERT(!PageDirty(page)); - LASSERT(PageLocked(page)); - - exp = ll_i2obdexp(inode); - if (exp == NULL) - GOTO(out, rc = -EINVAL); - - llap = llap_from_page(page); - if (IS_ERR(llap)) - GOTO(out, rc = PTR_ERR(llap)); - - page_cache_get(page); - if (llap->llap_write_queued) { - LL_CDEBUG_PAGE(D_PAGE, page, "marking urgent\n"); - rc = obd_set_async_flags(exp, ll_i2info(inode)->lli_smd, NULL, - llap->llap_cookie, - ASYNC_READY | ASYNC_URGENT); - } else { - llap->llap_write_queued = 1; - rc = obd_queue_async_io(exp, ll_i2info(inode)->lli_smd, NULL, - llap->llap_cookie, OBD_BRW_WRITE, 0, 0, - 0, ASYNC_READY | ASYNC_URGENT); - if (rc == 0) - LL_CDEBUG_PAGE(D_PAGE, page, "mmap write queued\n"); - else - llap->llap_write_queued = 0; - } - if (rc) - page_cache_release(page); -out: - if (rc) - unlock_page(page); - RETURN(rc); -} - static int ll_direct_IO_24(int rw, #ifdef HAVE_DIO_FILE struct file *file, @@ -116,11 +73,6 @@ static int ll_direct_IO_24(int rw, if (!lsm || !lsm->lsm_object_id) RETURN(-EBADF); - /* FIXME: io smaller than PAGE_SIZE is broken on ia64 */ - if ((iobuf->offset & (PAGE_SIZE - 1)) || - (iobuf->length & (PAGE_SIZE - 1))) - RETURN(-EINVAL); - set = ptlrpc_prep_set(); if (set == NULL) RETURN(-ENOMEM); @@ -132,15 +84,17 @@ static int ll_direct_IO_24(int rw, } flags = 0 /* | OBD_BRW_DIRECTIO */; - offset = ((obd_off)blocknr << inode->i_blkbits); + offset = ((obd_off)blocknr * blocksize); length = iobuf->length; + pga[0].page_offset = iobuf->offset; + LASSERT(iobuf->offset < PAGE_SIZE); for (i = 0, length = iobuf->length; length > 0; length -= pga[i].count, offset += pga[i].count, i++) { /*i last!*/ pga[i].pg = iobuf->maplist[i]; - pga[i].off = offset; + pga[i].disk_offset = offset; /* To the end of the page, or the length, whatever is less */ - pga[i].count = min_t(int, PAGE_SIZE - (offset & ~PAGE_MASK), + pga[i].count = min_t(int, PAGE_SIZE - pga[i].page_offset, length); pga[i].flag = flags; if (rw == READ) @@ -167,6 +121,14 @@ static int ll_direct_IO_24(int rw, CERROR("error from callback: rc = %d\n", rc); } ptlrpc_set_destroy(set); + if (rc == 0 && rw == WRITE) { + void lov_increase_kms(struct obd_export *, + struct lov_stripe_md *, obd_off size); + obd_off size = offset + length; + lov_increase_kms(ll_i2obdexp(inode), lsm, size); + if (size > inode->i_size) + inode->i_size = size; + } if (rc == 0) { rc = iobuf->length; obdo_to_inode(inode, &oa, OBD_MD_FLBLOCKS); @@ -179,7 +141,7 @@ static int ll_direct_IO_24(int rw, struct address_space_operations ll_aops = { .readpage = ll_readpage, .direct_IO = ll_direct_IO_24, - .writepage = ll_writepage_24, + .writepage = ll_writepage, .prepare_write = ll_prepare_write, .commit_write = ll_commit_write, .removepage = ll_removepage,