- ENTRY;
-
- lov_tgts_lock(lov);
- if ((flags & LTD_ACTIVE) && (tgt->ltd_flags & LTD_ACTIVE))
- lov->desc.ld_active_tgt_count--;
- tgt->ltd_flags &= ~flags;
- lov_tgts_unlock(lov);
- EXIT;
-}
-
-static inline int
-lov_tgt_changed(struct lov_obd *lov, struct lov_oinfo *loi)
-{
- int changed;
-
- lov_tgts_lock(lov);
- changed = lov->tgts[loi->loi_ost_idx].ltd_gen != loi->loi_ost_gen;
- lov_tgts_unlock(lov);
-
- return changed;
-}
-
-static inline int
-lov_tgt_active(struct lov_obd *lov, struct lov_tgt_desc *tgt, int gen)
-{
- int rc = 0;
- lov_tgts_lock(lov);
-
- if (((gen == 0) || (gen == tgt->ltd_gen)) &&
- ((tgt->ltd_flags &(LTD_ACTIVE|LTD_DEL_PENDING)) == LTD_ACTIVE)) {
- tgt->ltd_refcount++;
- rc = 1;
- }
-
- lov_tgts_unlock(lov);
- return rc;
-}
-
-static inline int
-lov_tgt_ready(struct lov_obd *lov, struct lov_tgt_desc *tgt, int gen)
-{
- int rc = 0;
-
- lov_tgts_lock(lov);
-
- if (((gen == 0) || (gen == tgt->ltd_gen)) &&
- (tgt->ltd_flags & LTD_ACTIVE)) {
- tgt->ltd_refcount++;
- rc = 1;
- }
-
- lov_tgts_unlock(lov);
- return rc;
-}
-
-static inline void
-lov_tgt_decref(struct lov_obd *lov, struct lov_tgt_desc *tgt)
-{
- int do_wakeup = 0;
-
- lov_tgts_lock(lov);
-
- if ((--tgt->ltd_refcount == 0) && (tgt->ltd_flags & LTD_DEL_PENDING)) {
- do_wakeup = 1;
- }
-
- lov_tgts_unlock(lov);
- if (do_wakeup)
- wake_up(&lov->lov_tgt_waitq);
-}
-
-struct lov_async_page {
- int lap_magic;
- int lap_stripe;
- obd_off lap_sub_offset;
- void *lap_sub_cookie;
- struct obd_async_page_ops *lap_caller_ops;
- void *lap_caller_data;
- obd_id lap_loi_id;
-};
-
-#define LAP_FROM_COOKIE(c) \
- (LASSERT(((struct lov_async_page *)(c))->lap_magic == LAP_MAGIC), \
- (struct lov_async_page *)(c))
-
-static inline void lov_llh_addref(void *llhp)
-{
- struct lov_lock_handles *llh = llhp;
- atomic_inc(&llh->llh_refcount);
- CDEBUG(D_INFO, "GETting llh %p : new refcount %d\n", llh,
- atomic_read(&llh->llh_refcount));
-}
-
-static inline struct lov_lock_handles *lov_llh_new(struct lov_stripe_md *lsm)
-{
- struct lov_lock_handles *llh;
-
- OBD_ALLOC(llh, sizeof *llh +
- sizeof(*llh->llh_handles) * lsm->lsm_stripe_count);
- if (llh == NULL)
- return NULL;
- atomic_set(&llh->llh_refcount, 2);
- llh->llh_stripe_count = lsm->lsm_stripe_count;
- INIT_LIST_HEAD(&llh->llh_handle.h_link);
- class_handle_hash(&llh->llh_handle, lov_llh_addref);
- return llh;