* lockers handled correctly. fixes from bug 20 will make it
* more efficient by associating locks with pages and with
* batching writeback under the lock explicitly. */
- for (i = start, j = start % count ; i <= end;
+ for (i = start, j = start % count; i <= end;
j++, i++, tmpex.l_extent.start += PAGE_CACHE_SIZE) {
+ if (j == count) {
+ CDEBUG(D_PAGE, "skip index %lu to %lu\n", i, i + skip);
+ i += skip;
+ j = 0;
+ if (i > end)
+ break;
+ }
LASSERTF(tmpex.l_extent.start< lock->l_policy_data.l_extent.end,
LPU64" >= "LPU64" start %lu i %lu end %lu\n",
tmpex.l_extent.start, lock->l_policy_data.l_extent.end,
page = find_get_page(inode->i_mapping, i);
if (page == NULL)
- goto next_index;
- LL_CDEBUG_PAGE(D_PAGE, page, "locking page\n");
+ continue;
+ LL_CDEBUG_PAGE(D_PAGE, page, "lock page idx %lu ext "LPU64"\n",
+ i, tmpex.l_extent.start);
lock_page(page);
/* page->mapping to check with racing against teardown */
}
unlock_page(page);
page_cache_release(page);
-
- next_index:
- if (j == count) {
- i += skip;
- j = 0;
- }
}
+ LASSERTF(tmpex.l_extent.start <=
+ (lock->l_policy_data.l_extent.end == ~0ULL ? ~0ULL :
+ lock->l_policy_data.l_extent.end + 1),
+ "loop too long "LPU64" > "LPU64" start %lu i %lu end %lu\n",
+ tmpex.l_extent.start, lock->l_policy_data.l_extent.end,
+ start, i, end);
EXIT;
}
LCK_PR, &flags, ll_extent_lock_callback,
ldlm_completion_ast, ll_glimpse_callback, inode,
sizeof(*lvb), lustre_swab_ost_lvb, &lockh);
- if (rc > 0) {
+ if (rc != 0) {
CERROR("obd_enqueue returned rc %d, returning -EIO\n", rc);
- RETURN(-EIO);
+ RETURN(rc > 0 ? -EIO : rc);
}
lvb->lvb_size = lov_merge_size(lli->lli_smd, 0);
retval = generic_file_write(file, buf, count, ppos);
out:
- /* XXX errors? */
- lprocfs_counter_add(ll_i2sbi(inode)->ll_stats, LPROC_LL_WRITE_BYTES,
- retval);
ll_extent_unlock(fd, inode, lsm, LCK_PW, &lockh);
+ lprocfs_counter_add(ll_i2sbi(inode)->ll_stats, LPROC_LL_WRITE_BYTES,
+ retval > 0 ? retval : 0);
RETURN(retval);
}
}
static int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
- int flags, struct lov_user_md *lum, int lum_size)
+ int flags, struct lov_user_md *lum,
+ int lum_size)
{
struct ll_inode_info *lli = ll_i2info(inode);
struct file *f;
struct inode *inode = dentry->d_inode;
struct ll_inode_info *lli;
struct lov_stripe_md *lsm;
+ int rc;
ENTRY;
if (!inode) {
struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
struct ll_fid fid;
unsigned long valid = 0;
- int rc, ealen = 0;
+ int ealen = 0;
if (S_ISREG(inode->i_mode)) {
ealen = obd_size_diskmd(sbi->ll_osc_exp, NULL);
* the file */
{
struct ost_lvb lvb;
- ldlm_error_t err;
- err = ll_glimpse_size(inode, &lvb);
+ rc = ll_glimpse_size(inode, &lvb);
inode->i_size = lvb.lvb_size;
}
- RETURN(0);
+ RETURN(rc);
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))