* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2015, Intel Corporation.
+ * Copyright (c) 2012, 2016, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#define __REQ_WRITE BIO_RW
#endif
+#ifdef HAVE_BIO_ENDIO_USES_ONE_ARG
+static void dio_complete_routine(struct bio *bio)
+{
+ int error = bio->bi_error;
+#else
static void dio_complete_routine(struct bio *bio, int error)
{
+#endif
struct osd_iobuf *iobuf = bio->bi_private;
-#ifdef HAVE_BVEC_ITER
- struct bvec_iter iter;
- struct bio_vec bvl;
-#else
int iter;
struct bio_vec *bvl;
-#endif
/* CAVEAT EMPTOR: possibly in IRQ context
* DO NOT record procfs stats here!!! */
"IO - you will probably have to reboot this node.\n");
CERROR("bi_next: %p, bi_flags: %lx, bi_rw: %lu, bi_vcnt: %d, "
"bi_idx: %d, bi->size: %d, bi_end_io: %p, bi_cnt: %d, "
- "bi_private: %p\n", bio->bi_next, bio->bi_flags,
+ "bi_private: %p\n", bio->bi_next,
+ (unsigned long)bio->bi_flags,
bio->bi_rw, bio->bi_vcnt, bio_idx(bio),
bio_sectors(bio) << 9, bio->bi_end_io,
- atomic_read(&bio->bi_cnt), bio->bi_private);
+#ifdef HAVE_BI_CNT
+ atomic_read(&bio->bi_cnt),
+#else
+ atomic_read(&bio->__bi_cnt),
+#endif
+ bio->bi_private);
return;
}
struct page *fp = NULL;
int clen = 0;
pgoff_t max_page_index;
+ handle_t *handle = NULL;
max_page_index = inode->i_sb->s_maxbytes >> PAGE_SHIFT;
CDEBUG(D_OTHER, "inode %lu: map %d pages from %lu\n",
inode->i_ino, pages, (*page)->index);
+ if (create) {
+ create = LDISKFS_GET_BLOCKS_CREATE;
+ handle = ldiskfs_journal_current_handle();
+ LASSERT(handle != NULL);
+ rc = osd_attach_jinode(inode);
+ if (rc)
+ return rc;
+ }
/* pages are sorted already. so, we just have to find
* contig. space and process them properly */
while (i < pages) {
long blen, total = 0;
- handle_t *handle = NULL;
struct ldiskfs_map_blocks map = { 0 };
if (fp == NULL) { /* start new extent */
/* process found extent */
map.m_lblk = fp->index * blocks_per_page;
map.m_len = blen = clen * blocks_per_page;
- if (create) {
- create = LDISKFS_GET_BLOCKS_CREATE;
- handle = ldiskfs_journal_current_handle();
- LASSERT(handle != NULL);
- }
cont_map:
rc = ldiskfs_map_blocks(handle, inode, &map, create);
if (rc >= 0) {
struct osd_iobuf *iobuf = &oti->oti_iobuf;
struct inode *inode = osd_dt_obj(dt)->oo_inode;
struct osd_device *osd = osd_obj2dev(osd_dt_obj(dt));
- struct timeval start;
- struct timeval end;
- unsigned long timediff;
+ ktime_t start;
+ ktime_t end;
+ s64 timediff;
ssize_t isize;
__s64 maxidx;
int rc = 0;
if (isize > osd->od_readcache_max_filesize)
cache = 0;
- do_gettimeofday(&start);
+ start = ktime_get();
for (i = 0; i < npages; i++) {
if (cache == 0)
kunmap(lnb[i].lnb_page);
}
}
- do_gettimeofday(&end);
- timediff = cfs_timeval_sub(&end, &start, NULL);
+ end = ktime_get();
+ timediff = ktime_us_delta(end, start);
lprocfs_counter_add(osd->od_stats, LPROC_OSD_GET_PAGE, timediff);
if (iobuf->dr_npages) {
struct osd_iobuf *iobuf = &oti->oti_iobuf;
struct inode *inode = osd_dt_obj(dt)->oo_inode;
struct osd_device *osd = osd_obj2dev(osd_dt_obj(dt));
- struct timeval start, end;
- unsigned long timediff;
int rc = 0, i, cache = 0, cache_hits = 0, cache_misses = 0;
+ ktime_t start, end;
+ s64 timediff;
loff_t isize;
LASSERT(inode);
if (isize > osd->od_readcache_max_filesize)
cache = 0;
- do_gettimeofday(&start);
+ start = ktime_get();
for (i = 0; i < npages; i++) {
if (isize <= lnb[i].lnb_file_offset)
else
lnb[i].lnb_rc = lnb[i].lnb_len;
+ /* Bypass disk read if fail_loc is set properly */
+ if (OBD_FAIL_CHECK(OBD_FAIL_OST_FAKE_RW))
+ SetPageUptodate(lnb[i].lnb_page);
+
if (PageUptodate(lnb[i].lnb_page)) {
cache_hits++;
} else {
generic_error_remove_page(inode->i_mapping,
lnb[i].lnb_page);
}
- do_gettimeofday(&end);
- timediff = cfs_timeval_sub(&end, &start, NULL);
+ end = ktime_get();
+ timediff = ktime_us_delta(end, start);
lprocfs_counter_add(osd->od_stats, LPROC_OSD_GET_PAGE, timediff);
if (cache_hits != 0)