From: zhanghc Date: Tue, 7 Feb 2006 10:34:40 +0000 (+0000) Subject: land bug9972(b1_4_lov_lvb_cleanup) on b_release_1_4_6 X-Git-Tag: v1_7_100~1^103~4^2~45 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=137c0d07e777a1506ee99585645f2e69cf8d9d4a;p=fs%2Flustre-release.git land bug9972(b1_4_lov_lvb_cleanup) on b_release_1_4_6 DESCRIPTION: replace loi_rss,loi_mtime,loi_ctime,loi_ctime with struct ost_lvb. on the same time, add obd_merge_lvb(lov_merge_lvb) into obd_ops (lov_obd_ops) BUG: 9972 Modified Files: Tag: b_release_1_4_6 include/linux/lustre_lib.h include/linux/obd.h include/linux/obd_class.h liblustre/llite_lib.h liblustre/rw.c liblustre/super.c llite/file.c llite/llite_mmap.c llite/rw.c lov/lov_internal.h lov/lov_merge.c lov/lov_obd.c lov/lov_request.c obdclass/lprocfs_status.c obdfilter/filter_lvb.c osc/osc_request.c --- diff --git a/lustre/include/linux/lustre_lib.h b/lustre/include/linux/lustre_lib.h index 519c4e5..20d1d63 100644 --- a/lustre/include/linux/lustre_lib.h +++ b/lustre/include/linux/lustre_lib.h @@ -747,6 +747,20 @@ do { \ }) #ifdef __KERNEL__ +/* initialize ost_lvb according to inode */ +static inline void inode_init_lvb(struct inode *inode, struct ost_lvb *lvb) +{ + lvb->lvb_size = inode->i_size; + lvb->lvb_blocks = inode->i_blocks; + lvb->lvb_mtime = LTIME_S(inode->i_mtime); + lvb->lvb_atime = LTIME_S(inode->i_atime); + lvb->lvb_ctime = LTIME_S(inode->i_ctime); +} +#else +/* defined in liblustre/llite_lib.h */ +#endif + +#ifdef __KERNEL__ #define LIBLUSTRE_CLIENT (0) #else #define LIBLUSTRE_CLIENT (1) diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index aff3ea3..11115be 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -62,10 +62,7 @@ struct lov_oinfo { /* per-stripe data structure */ unsigned loi_kms_valid:1; __u64 loi_kms; /* known minimum size */ - __u64 loi_rss; /* recently seen size */ - __u64 loi_mtime; /* recently seen mtime */ - __u64 loi_blocks; /* recently seen blocks */ - + struct ost_lvb loi_lvb; struct osc_async_rc loi_ar; }; @@ -769,6 +766,8 @@ struct obd_ops { int (*o_teardown_async_page)(struct obd_export *exp, struct lov_stripe_md *lsm, struct lov_oinfo *loi, void *cookie); + int (*o_merge_lvb)(struct obd_export *exp, struct lov_stripe_md *lsm, + struct ost_lvb *lvb, int kms_only); int (*o_adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm, obd_off size, int shrink); int (*o_punch)(struct obd_export *exp, struct obdo *oa, diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index 4864efa..cc77d51 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -863,10 +863,19 @@ static inline int obd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, RETURN(rc); } -/* b1_4_bug5047 has changes to make this an obd_merge_lvb() method */ -__u64 lov_merge_size(struct lov_stripe_md *lsm, int kms_only); -__u64 lov_merge_blocks(struct lov_stripe_md *lsm); -__u64 lov_merge_mtime(struct lov_stripe_md *lsm, __u64 current_time); +static inline int obd_merge_lvb(struct obd_export *exp, + struct lov_stripe_md *lsm, + struct ost_lvb *lvb, int kms_only) +{ + int rc; + ENTRY; + + OBD_CHECK_OP(exp->exp_obd, merge_lvb, -EOPNOTSUPP); + OBD_COUNTER_INCREMENT(exp->exp_obd, merge_lvb); + + rc = OBP(exp->exp_obd, merge_lvb)(exp, lsm, lvb, kms_only); + RETURN(rc); +} static inline int obd_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, obd_off size, diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h index fdc9268..4508ee6 100644 --- a/lustre/liblustre/llite_lib.h +++ b/lustre/liblustre/llite_lib.h @@ -255,4 +255,14 @@ static inline struct ext2_dirent *ext2_next_entry(struct ext2_dirent *p) return (struct ext2_dirent*)((char*) p + le16_to_cpu(p->rec_len)); } +static inline void inode_init_lvb(struct inode *inode, struct ost_lvb *lvb) +{ + struct intnl_stat *st = llu_i2stat(inode); + lvb->lvb_size = st->st_size; + lvb->lvb_blocks = st->st_blocks; + lvb->lvb_mtime = st->st_mtime; + lvb->lvb_atime = st->st_atime; + lvb->lvb_ctime = st->st_ctime; +} + #endif diff --git a/lustre/liblustre/rw.c b/lustre/liblustre/rw.c index 3804c93..f556c74 100644 --- a/lustre/liblustre/rw.c +++ b/lustre/liblustre/rw.c @@ -226,6 +226,7 @@ int llu_glimpse_size(struct inode *inode) struct llu_sb_info *sbi = llu_i2sbi(inode); ldlm_policy_data_t policy = { .l_extent = { 0, OBD_OBJECT_EOF } }; struct lustre_handle lockh = { 0 }; + struct ost_lvb lvb; int rc, flags = LDLM_FL_HAS_INTENT; ENTRY; @@ -240,9 +241,13 @@ int llu_glimpse_size(struct inode *inode) RETURN(rc > 0 ? -EIO : rc); } - st->st_size = lov_merge_size(lli->lli_smd, 0); - st->st_blocks = lov_merge_blocks(lli->lli_smd); - st->st_mtime = lov_merge_mtime(lli->lli_smd, st->st_mtime); + inode_init_lvb(inode, &lvb); + obd_merge_lvb(sbi->ll_osc_exp, lli->lli_smd, &lvb, 0); + st->st_size = lvb.lvb_size; + st->st_blocks = lvb.lvb_blocks; + st->st_mtime = lvb.lvb_mtime; + st->st_atime = lvb.lvb_atime; + st->st_ctime = lvb.lvb_ctime; CDEBUG(D_DLMTRACE, "glimpse: size: %llu, blocks: %llu\n", (long long)st->st_size, (long long)st->st_blocks); @@ -259,6 +264,7 @@ int llu_extent_lock(struct ll_file_data *fd, struct inode *inode, { struct llu_sb_info *sbi = llu_i2sbi(inode); struct intnl_stat *st = llu_i2stat(inode); + struct ost_lvb lvb; int rc; ENTRY; @@ -281,12 +287,17 @@ int llu_extent_lock(struct ll_file_data *fd, struct inode *inode, if (rc > 0) rc = -EIO; + inode_init_lvb(inode, &lvb); + obd_merge_lvb(sbi->ll_osc_exp, lsm, &lvb, 1); if (policy->l_extent.start == 0 && policy->l_extent.end == OBD_OBJECT_EOF) - st->st_size = lov_merge_size(lsm, 1); + st->st_size = lvb.lvb_size; - if (rc == 0) - st->st_mtime = lov_merge_mtime(lsm, st->st_mtime); + if (rc == 0) { + st->st_mtime = lvb.lvb_mtime; + st->st_atime = lvb.lvb_atime; + st->st_ctime = lvb.lvb_ctime; + } RETURN(rc); } @@ -566,6 +577,7 @@ ssize_t llu_file_prwv(const struct iovec *iovec, int iovlen, struct obd_export *exp = NULL; struct llu_io_group *iogroup; struct lustre_rw_params p; + struct ost_lvb lvb; __u64 kms; int err, is_read, iovidx, ret; int local_lock; @@ -608,7 +620,9 @@ ssize_t llu_file_prwv(const struct iovec *iovec, int iovlen, * date, and, hence, cannot be used for short-read * detection. Rely in OST to handle short reads in that case. */ - kms = lov_merge_size(lsm, 1); + inode_init_lvb(inode, &lvb); + obd_merge_lvb(exp, lsm, &lvb, 1); + kms = lvb.lvb_size; /* extent.end is last byte of the range */ if (p.lrp_policy.l_extent.end >= kms) { /* A glimpse is necessary to determine whether diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 17b96de..f6d2f08 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -149,11 +149,14 @@ void llu_update_inode(struct inode *inode, struct mds_body *body, if (body->valid & OBD_MD_FLID) st->st_ino = body->ino; - if (body->valid & OBD_MD_FLATIME) - LTIME_S(st->st_atime) = body->atime; - if (body->valid & OBD_MD_FLMTIME) + if (body->valid & OBD_MD_FLATIME && + body->mtime > LTIME_S(st->st_mtime)) LTIME_S(st->st_mtime) = body->mtime; - if (body->valid & OBD_MD_FLCTIME) + if (body->valid & OBD_MD_FLMTIME && + body->atime > LTIME_S(st->st_atime)) + LTIME_S(st->st_atime) = body->atime; + if (body->valid & OBD_MD_FLCTIME && + body->ctime > LTIME_S(st->st_ctime)) LTIME_S(st->st_ctime) = body->ctime; if (body->valid & OBD_MD_FLMODE) st->st_mode = (st->st_mode & S_IFMT)|(body->mode & ~S_IFMT); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 6da3b77..bef7220 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -671,7 +671,7 @@ static int ll_glimpse_callback(struct ldlm_lock *lock, void *reqp) return rc; } -/* NB: lov_merge_size will prefer locally cached writes if they extend the +/* NB: obd_merge_lvb will prefer locally cached writes if they extend the * file (because it prefers KMS over RSS when larger) */ int ll_glimpse_size(struct inode *inode, int ast_flags) { @@ -679,6 +679,7 @@ int ll_glimpse_size(struct inode *inode, int ast_flags) struct ll_sb_info *sbi = ll_i2sbi(inode); ldlm_policy_data_t policy = { .l_extent = { 0, OBD_OBJECT_EOF } }; struct lustre_handle lockh = { 0 }; + struct ost_lvb lvb; int rc; ENTRY; @@ -705,11 +706,14 @@ int ll_glimpse_size(struct inode *inode, int ast_flags) } ll_inode_size_lock(inode, 1); - inode->i_size = lov_merge_size(lli->lli_smd, 0); - inode->i_blocks = lov_merge_blocks(lli->lli_smd); + inode_init_lvb(inode, &lvb); + obd_merge_lvb(sbi->ll_osc_exp, lli->lli_smd, &lvb, 0); + inode->i_size = lvb.lvb_size; + inode->i_blocks = lvb.lvb_blocks; + LTIME_S(inode->i_mtime) = lvb.lvb_mtime; + LTIME_S(inode->i_atime) = lvb.lvb_atime; + LTIME_S(inode->i_ctime) = lvb.lvb_ctime; ll_inode_size_unlock(inode, 1); - LTIME_S(inode->i_mtime) = - lov_merge_mtime(lli->lli_smd, LTIME_S(inode->i_mtime)); CDEBUG(D_DLMTRACE, "glimpse: size: %llu, blocks: %lu\n", inode->i_size, inode->i_blocks); @@ -725,6 +729,7 @@ int ll_extent_lock(struct ll_file_data *fd, struct inode *inode, int ast_flags) { struct ll_sb_info *sbi = ll_i2sbi(inode); + struct ost_lvb lvb; int rc; ENTRY; @@ -750,6 +755,10 @@ int ll_extent_lock(struct ll_file_data *fd, struct inode *inode, if (rc > 0) rc = -EIO; + ll_inode_size_lock(inode, 1); + inode_init_lvb(inode, &lvb); + obd_merge_lvb(sbi->ll_osc_exp, lsm, &lvb, 0); + if (policy->l_extent.start == 0 && policy->l_extent.end == OBD_OBJECT_EOF) { /* vmtruncate()->ll_truncate() first sets the i_size and then @@ -762,14 +771,16 @@ int ll_extent_lock(struct ll_file_data *fd, struct inode *inode, * cancel the result of the truncate. Getting the * ll_inode_size_lock() after the enqueue maintains the DLM * -> ll_inode_size_lock() acquiring order. */ - ll_inode_size_lock(inode, 1); - inode->i_size = lov_merge_size(lsm, 1); - ll_inode_size_unlock(inode, 1); + inode->i_size = lvb.lvb_size; } - if (rc == 0) - LTIME_S(inode->i_mtime) = - lov_merge_mtime(lsm, LTIME_S(inode->i_mtime)); + if (rc == 0) { + LTIME_S(inode->i_mtime) = lvb.lvb_mtime; + LTIME_S(inode->i_atime) = lvb.lvb_atime; + LTIME_S(inode->i_ctime) = lvb.lvb_ctime; + } + ll_inode_size_unlock(inode, 1); + RETURN(rc); } @@ -799,6 +810,7 @@ static ssize_t ll_file_read(struct file *file, char *buf, size_t count, struct lov_stripe_md *lsm = lli->lli_smd; struct ll_lock_tree tree; struct ll_lock_tree_node *node; + struct ost_lvb lvb; struct ll_ra_read bead; int rc; ssize_t retval; @@ -868,7 +880,9 @@ static ssize_t ll_file_read(struct file *file, char *buf, size_t count, * ll_inode_size_lock(). This guarantees that short reads are handled * correctly in the face of concurrent writes and truncates. */ - kms = lov_merge_size(lsm, 1); + inode_init_lvb(inode, &lvb); + obd_merge_lvb(ll_i2sbi(inode)->ll_osc_exp, lsm, &lvb, 1); + kms = lvb.lvb_size; if (*ppos + count - 1 > kms) { /* A glimpse is necessary to determine whether we return a * short read (B) or some zeroes at the end of the buffer (C) */ diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index 18c122d..2e77ba8 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -368,6 +368,7 @@ struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address, struct page *page = NULL; struct ll_inode_info *lli = ll_i2info(inode); struct lov_stripe_md *lsm; + struct ost_lvb lvb; __u64 kms, old_mtime; unsigned long pgoff, size, rand_read, seq_read; int rc = 0; @@ -397,7 +398,9 @@ struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address, CWARN("binary changed. inode %lu\n", inode->i_ino); lov_stripe_lock(lsm); - kms = lov_merge_size(lsm, 1); + inode_init_lvb(inode, &lvb); + obd_merge_lvb(ll_i2obdexp(inode), lsm, &lvb, 1); + kms = lvb.lvb_size; pgoff = ((address - vma->vm_start) >> PAGE_CACHE_SHIFT) + vma->vm_pgoff; size = (kms + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 5675f36..bca0abd 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -111,6 +111,7 @@ void ll_truncate(struct inode *inode) { struct ll_inode_info *lli = ll_i2info(inode); struct lov_stripe_md *lsm = lli->lli_smd; + struct ost_lvb lvb; struct obdo oa; int rc; ENTRY; @@ -133,7 +134,9 @@ void ll_truncate(struct inode *inode) /* XXX I'm pretty sure this is a hack to paper over a more fundamental * race condition. */ lov_stripe_lock(lsm); - if (lov_merge_size(lsm, 0) == inode->i_size) { + inode_init_lvb(inode, &lvb); + obd_merge_lvb(ll_i2obdexp(inode), lsm, &lvb, 0); + if (lvb.lvb_size == inode->i_size) { CDEBUG(D_VFSTRACE, "skipping punch for obj "LPX64", %Lu=%#Lx\n", lsm->lsm_object_id, inode->i_size, inode->i_size); lov_stripe_unlock(lsm); @@ -195,7 +198,7 @@ int ll_prepare_write(struct file *file, struct page *page, unsigned from, obd_off offset = ((obd_off)page->index) << PAGE_SHIFT; struct brw_page pga; struct obdo oa; - __u64 kms; + struct ost_lvb lvb; int rc = 0; ENTRY; @@ -235,11 +238,12 @@ int ll_prepare_write(struct file *file, struct page *page, unsigned from, * locking will have updated the KMS, and for our purposes here we can * treat it like i_size. */ lov_stripe_lock(lsm); - kms = lov_merge_size(lsm, 1); + inode_init_lvb(inode, &lvb); + obd_merge_lvb(ll_i2obdexp(inode), lsm, &lvb, 0); lov_stripe_unlock(lsm); - if (kms <= offset) { + if (lvb.lvb_size <= offset) { LL_CDEBUG_PAGE(D_PAGE, page, "kms "LPU64" <= offset "LPU64"\n", - kms, offset); + lvb.lvb_size, offset); memset(kmap(page), 0, PAGE_SIZE); kunmap(page); GOTO(prepare_done, rc = 0); @@ -312,6 +316,7 @@ static int ll_ap_refresh_count(void *data, int cmd) struct lov_stripe_md *lsm; struct page *page; struct inode *inode; + struct ost_lvb lvb; __u64 kms; ENTRY; @@ -325,7 +330,9 @@ static int ll_ap_refresh_count(void *data, int cmd) lsm = lli->lli_smd; lov_stripe_lock(lsm); - kms = lov_merge_size(lsm, 1); + inode_init_lvb(inode, &lvb); + obd_merge_lvb(ll_i2obdexp(inode), lsm, &lvb, 1); + kms = lvb.lvb_size; lov_stripe_unlock(lsm); /* catch race with truncate */ @@ -1037,13 +1044,16 @@ static int ll_readahead(struct ll_readahead_state *ras, struct inode *inode; struct lov_stripe_md *lsm; struct ll_ra_read *bead; + struct ost_lvb lvb; ENTRY; inode = mapping->host; lsm = ll_i2info(inode)->lli_smd; lov_stripe_lock(lsm); - kms = lov_merge_size(lsm, 1); + inode_init_lvb(inode, &lvb); + obd_merge_lvb(ll_i2obdexp(inode), lsm, &lvb, 1); + kms = lvb.lvb_size; lov_stripe_unlock(lsm); if (kms == 0) { ll_ra_stats_inc(mapping, RA_STAT_ZERO_LEN); diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index 5dff3ba..68c762f 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -113,6 +113,8 @@ static inline void lov_llh_put(struct lov_lock_handles *llh) /* lov_merge.c */ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, obd_flag valid, struct lov_stripe_md *lsm, int stripeno, int *set); +int lov_merge_lvb(struct obd_export *exp, struct lov_stripe_md *lsm, + struct ost_lvb *lvb, int kms_only); int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, obd_off size, int shrink); diff --git a/lustre/lov/lov_merge.c b/lustre/lov/lov_merge.c index 4b1ff36..d874fed 100644 --- a/lustre/lov/lov_merge.c +++ b/lustre/lov/lov_merge.c @@ -38,15 +38,24 @@ #include "lov_internal.h" -/* Merge rss if kms == 0 +/* Merge the lock value block(&lvb) attributes from each of the stripes in a + * file into a single lvb. It is expected that the caller initializes the + * current atime, mtime, ctime to avoid regressing a more uptodate time on + * the local client. * - * Even when merging RSS, we will take the KMS value if it's larger. - * This prevents getattr from stomping on dirty cached pages which - * extend the file size. */ -__u64 lov_merge_size(struct lov_stripe_md *lsm, int kms) + * If @kms_only is set then we do not consider the recently seen size (rss) + * when updating the known minimum size (kms). Even when merging RSS, we will + * take the KMS value if it's larger. This prevents getattr from stomping on + * dirty cached pages which extend the file size. */ +int lov_merge_lvb(struct obd_export *exp, struct lov_stripe_md *lsm, + struct ost_lvb *lvb, int kms_only) { struct lov_oinfo *loi; __u64 size = 0; + __u64 blocks = 0; + __u64 current_mtime = lvb->lvb_mtime; + __u64 current_atime = lvb->lvb_atime; + __u64 current_ctime = lvb->lvb_ctime; int i; LASSERT_SPIN_LOCKED(&lsm->lsm_lock); @@ -59,42 +68,29 @@ __u64 lov_merge_size(struct lov_stripe_md *lsm, int kms) obd_size lov_size, tmpsize; tmpsize = loi->loi_kms; - if (kms == 0 && loi->loi_rss > tmpsize) - tmpsize = loi->loi_rss; + if (kms_only == 0 && loi->loi_lvb.lvb_size > tmpsize) + tmpsize = loi->loi_lvb.lvb_size; lov_size = lov_stripe_size(lsm, tmpsize, i); if (lov_size > size) size = lov_size; + /* merge blocks, mtime, atime */ + blocks += loi->loi_lvb.lvb_blocks; + if (loi->loi_lvb.lvb_mtime > current_mtime) + current_mtime = loi->loi_lvb.lvb_mtime; + if (loi->loi_lvb.lvb_atime > current_atime) + current_atime = loi->loi_lvb.lvb_atime; + if (loi->loi_lvb.lvb_ctime > current_ctime) + current_ctime = loi->loi_lvb.lvb_ctime; } - return size; -} -EXPORT_SYMBOL(lov_merge_size); - -/* Merge blocks */ -__u64 lov_merge_blocks(struct lov_stripe_md *lsm) -{ - struct lov_oinfo *loi; - __u64 blocks = 0; - int i; - - for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++, loi++) - blocks += loi->loi_blocks; - return blocks; -} -EXPORT_SYMBOL(lov_merge_blocks); - -__u64 lov_merge_mtime(struct lov_stripe_md *lsm, __u64 current_time) -{ - struct lov_oinfo *loi; - int i; - - for (i = 0, loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++, loi++) - if (loi->loi_mtime > current_time) - current_time = loi->loi_mtime; - return current_time; + lvb->lvb_size = size; + lvb->lvb_blocks = blocks; + lvb->lvb_mtime = current_mtime; + lvb->lvb_atime = current_atime; + lvb->lvb_ctime = current_ctime; + RETURN(0); } -EXPORT_SYMBOL(lov_merge_mtime); /* Must be called under the lov_stripe_lock() */ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, @@ -115,7 +111,7 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, for (loi = lsm->lsm_oinfo; stripe < lsm->lsm_stripe_count; stripe++, loi++) { kms = lov_size_to_stripe(lsm, size, stripe); - loi->loi_kms = loi->loi_rss = kms; + loi->loi_kms = loi->loi_lvb.lvb_size = kms; CDEBUG(D_INODE, "stripe %d KMS %sing "LPU64"->"LPU64"\n", stripe, kms > loi->loi_kms ? "increas":"shrink", diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 1310aac..502c087 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -2376,6 +2376,7 @@ struct obd_ops lov_obd_ops = { .o_queue_group_io = lov_queue_group_io, .o_trigger_group_io = lov_trigger_group_io, .o_teardown_async_page = lov_teardown_async_page, + .o_merge_lvb = lov_merge_lvb, .o_adjust_kms = lov_adjust_kms, .o_punch = lov_punch, .o_sync = lov_sync, diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index 1d3edef..b6b4b62 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -129,26 +129,24 @@ int lov_update_enqueue_set(struct lov_request_set *set, * can be addressed then. */ if (rc == ELDLM_OK) { struct ldlm_lock *lock = ldlm_handle2lock(lov_lockhp); - __u64 tmp = req->rq_md->lsm_oinfo->loi_rss; + __u64 tmp = req->rq_md->lsm_oinfo->loi_lvb.lvb_size; LASSERT(lock != NULL); lov_stripe_lock(set->set_md); - loi->loi_rss = tmp; - loi->loi_mtime = req->rq_md->lsm_oinfo->loi_mtime; - loi->loi_blocks = req->rq_md->lsm_oinfo->loi_blocks; + loi->loi_lvb = req->rq_md->lsm_oinfo->loi_lvb; /* Extend KMS up to the end of this lock and no further * A lock on [x,y] means a KMS of up to y + 1 bytes! */ if (tmp > lock->l_policy_data.l_extent.end) tmp = lock->l_policy_data.l_extent.end + 1; if (tmp >= loi->loi_kms) { - LDLM_DEBUG(lock, "lock acquired, setting rss=" - LPU64", kms="LPU64, loi->loi_rss, tmp); + LDLM_DEBUG(lock, "lock acquired, setting rss="LPU64 + ", kms="LPU64, loi->loi_lvb.lvb_size, tmp); loi->loi_kms = tmp; loi->loi_kms_valid = 1; } else { LDLM_DEBUG(lock, "lock acquired, setting rss=" LPU64"; leaving kms="LPU64", end="LPU64, - loi->loi_rss, loi->loi_kms, + loi->loi_lvb.lvb_size, loi->loi_kms, lock->l_policy_data.l_extent.end); } lov_stripe_unlock(set->set_md); @@ -157,12 +155,10 @@ int lov_update_enqueue_set(struct lov_request_set *set, } else if (rc == ELDLM_LOCK_ABORTED && flags & LDLM_FL_HAS_INTENT) { memset(lov_lockhp, 0, sizeof(*lov_lockhp)); lov_stripe_lock(set->set_md); - loi->loi_rss = req->rq_md->lsm_oinfo->loi_rss; - loi->loi_mtime = req->rq_md->lsm_oinfo->loi_mtime; - loi->loi_blocks = req->rq_md->lsm_oinfo->loi_blocks; + loi->loi_lvb = req->rq_md->lsm_oinfo->loi_lvb; lov_stripe_unlock(set->set_md); CDEBUG(D_INODE, "glimpsed, setting rss="LPU64"; leaving" - " kms="LPU64"\n", loi->loi_rss, loi->loi_kms); + " kms="LPU64"\n", loi->loi_lvb.lvb_size, loi->loi_kms); rc = ELDLM_OK; } else { struct obd_export *exp = set->set_exp; @@ -293,10 +289,8 @@ int lov_prep_enqueue_set(struct obd_export *exp, struct lov_stripe_md *lsm, req->rq_md->lsm_object_id = loi->loi_id; req->rq_md->lsm_stripe_count = 0; req->rq_md->lsm_oinfo->loi_kms_valid = loi->loi_kms_valid; - req->rq_md->lsm_oinfo->loi_rss = loi->loi_rss; req->rq_md->lsm_oinfo->loi_kms = loi->loi_kms; - req->rq_md->lsm_oinfo->loi_blocks = loi->loi_blocks; - req->rq_md->lsm_oinfo->loi_mtime = loi->loi_mtime; + req->rq_md->lsm_oinfo->loi_lvb = loi->loi_lvb; lov_set_add_req(req, set); } @@ -776,7 +770,7 @@ static int brw_done(struct lov_request_set *set) loi = &lsm->lsm_oinfo[req->rq_stripe]; if (req->rq_oa->o_valid & OBD_MD_FLBLOCKS) - loi->loi_blocks = req->rq_oa->o_blocks; + loi->loi_lvb.lvb_blocks = req->rq_oa->o_blocks; } RETURN(0); @@ -1141,6 +1135,7 @@ int lov_update_setattr_set(struct lov_request_set *set, struct lov_request *req, int rc) { struct lov_obd *lov = &set->set_exp->exp_obd->u.lov; + struct lov_stripe_md *lsm = set->set_md; ENTRY; lov_update_set(set, req, rc); @@ -1151,10 +1146,17 @@ int lov_update_setattr_set(struct lov_request_set *set, /* FIXME: LOV STACKING update loi data should be done by OSC * * when this is gone we can go back to using lov_update_common_set() */ - if (rc == 0 && req->rq_oa->o_valid & OBD_MD_FLMTIME) - set->set_md->lsm_oinfo[req->rq_stripe].loi_mtime = - req->rq_oa->o_mtime; - /* ditto loi_atime, loi_ctime when available */ + if (rc == 0) { + if (req->rq_oa->o_valid & OBD_MD_FLMTIME) + lsm->lsm_oinfo[req->rq_stripe].loi_lvb.lvb_ctime = + req->rq_oa->o_ctime; + if (req->rq_oa->o_valid & OBD_MD_FLMTIME) + lsm->lsm_oinfo[req->rq_stripe].loi_lvb.lvb_mtime = + req->rq_oa->o_mtime; + if (req->rq_oa->o_valid & OBD_MD_FLATIME) + lsm->lsm_oinfo[req->rq_stripe].loi_lvb.lvb_atime = + req->rq_oa->o_atime; + } RETURN(rc); } diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 1768612..025e188 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -694,6 +694,7 @@ int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats) LPROCFS_OBD_OP_INIT(num_private_stats, stats, trigger_group_io); LPROCFS_OBD_OP_INIT(num_private_stats, stats, set_async_flags); LPROCFS_OBD_OP_INIT(num_private_stats, stats, teardown_async_page); + LPROCFS_OBD_OP_INIT(num_private_stats, stats, merge_lvb); LPROCFS_OBD_OP_INIT(num_private_stats, stats, adjust_kms); LPROCFS_OBD_OP_INIT(num_private_stats, stats, punch); LPROCFS_OBD_OP_INIT(num_private_stats, stats, sync); diff --git a/lustre/obdfilter/filter_lvb.c b/lustre/obdfilter/filter_lvb.c index ce4d5b3..066f8dc 100644 --- a/lustre/obdfilter/filter_lvb.c +++ b/lustre/obdfilter/filter_lvb.c @@ -80,9 +80,7 @@ static int filter_lvbo_init(struct ldlm_resource *res) if (dentry->d_inode == NULL) GOTO(out_dentry, rc = -ENOENT); - lvb->lvb_size = dentry->d_inode->i_size; - lvb->lvb_mtime = LTIME_S(dentry->d_inode->i_mtime); - lvb->lvb_blocks = dentry->d_inode->i_blocks; + inode_init_lvb(dentry->d_inode, lvb); CDEBUG(D_DLMTRACE, "res: "LPU64" initial lvb size: "LPU64", " "mtime: "LPU64", blocks: "LPU64"\n", diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index d08b633..3172f00 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1439,9 +1439,13 @@ static void osc_ap_completion(struct client_obd *cli, struct obdo *oa, if (rc == 0 && oa != NULL) { if (oa->o_valid & OBD_MD_FLBLOCKS) - oap->oap_loi->loi_blocks = oa->o_blocks; + oap->oap_loi->loi_lvb.lvb_blocks = oa->o_blocks; if (oa->o_valid & OBD_MD_FLMTIME) - oap->oap_loi->loi_mtime = oa->o_mtime; + oap->oap_loi->loi_lvb.lvb_mtime = oa->o_mtime; + if (oa->o_valid & OBD_MD_FLATIME) + oap->oap_loi->loi_lvb.lvb_atime = oa->o_atime; + if (oa->o_valid & OBD_MD_FLCTIME) + oap->oap_loi->loi_lvb.lvb_ctime = oa->o_ctime; } if (oap->oap_oig) { @@ -2754,9 +2758,7 @@ static int osc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm, if ((*flags & LDLM_FL_HAS_INTENT && rc == ELDLM_LOCK_ABORTED) || !rc) { CDEBUG(D_INODE,"got kms "LPU64" blocks "LPU64" mtime "LPU64"\n", lvb.lvb_size, lvb.lvb_blocks, lvb.lvb_mtime); - lsm->lsm_oinfo->loi_rss = lvb.lvb_size; - lsm->lsm_oinfo->loi_mtime = lvb.lvb_mtime; - lsm->lsm_oinfo->loi_blocks = lvb.lvb_blocks; + lsm->lsm_oinfo->loi_lvb = lvb; } RETURN(rc);