/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * Copyright (C) 2001 Cluster File Systems, Inc.
+ * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
*
* This code is issued under the GNU General Public License.
* See the file COPYING in this distribution
int typ_refcnt;
};
-struct brw_page {
+struct brw_page {
struct page *pg;
obd_size count;
obd_off off;
struct recovd_obd {
__u32 recovd_phase;
__u32 recovd_next_phase;
- __u32 recovd_flags;
+ __u32 recovd_flags;
struct recovd_data *recovd_current_rd;
spinlock_t recovd_lock;
struct list_head recovd_managed_items; /* items managed */
};
-struct lov_tgt_desc {
+struct lov_tgt_desc {
uuid_t uuid;
- struct lustre_handle conn;
+ struct lustre_handle conn;
};
struct lov_obd {
struct lov_stripe_md *);
int (*o_brw)(int rw, struct lustre_handle *conn,
struct lov_stripe_md *md, obd_count oa_bufs,
- struct brw_page *pgarr, brw_callback_t callback,
+ struct brw_page *pgarr, brw_callback_t callback,
struct io_cb_data *data);
int (*o_punch)(struct lustre_handle *conn, struct obdo *tgt,
struct lov_stripe_md *md, obd_size count,
int niocount, struct niobuf_local *local,
void *desc_private);
int (*o_enqueue)(struct lustre_handle *conn, struct lov_stripe_md *md,
- struct lustre_handle *parent_lock,
+ struct lustre_handle *parent_lock,
__u32 type, void *cookie, int cookielen, __u32 mode,
int *flags, void *cb, void *data, int datalen,
struct lustre_handle *lockh);
- int (*o_cancel)(struct lustre_handle *, struct lov_stripe_md *md, __u32 mode, struct lustre_handle *);
+ int (*o_cancel)(struct lustre_handle *, struct lov_stripe_md *md,
+ __u32 mode, struct lustre_handle *);
+ int (*o_cancel_unused)(struct lustre_handle *, struct lov_stripe_md *);
};
static inline void *mds_fs_start(struct mds_obd *mds, struct inode *inode,
RETURN(rc);
}
+static int lov_cancel_unused(struct lustre_handle *conn,
+ struct lov_stripe_md *lsm)
+{
+ struct obd_export *export = class_conn2export(conn);
+ struct lov_obd *lov;
+ struct lov_oinfo *loi;
+ int rc = 0, i;
+ ENTRY;
+
+ if (!lsm) {
+ CERROR("LOV requires striping ea for lock cancellation\n");
+ RETURN(-EINVAL);
+ }
+
+ if (!export || !export->exp_obd)
+ RETURN(-ENODEV);
+
+ lov = &export->exp_obd->u.lov;
+ for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
+ struct lov_stripe_md submd;
+
+ submd.lsm_object_id = loi->loi_id;
+ submd.lsm_mds_easize = lov_mds_md_size(lsm->lsm_ost_count);
+ submd.lsm_stripe_count = 0;
+ rc = obd_cancel_unused(&lov->tgts[loi->loi_ost_idx].conn,
+ &submd);
+ if (rc)
+ CERROR("Error cancel unused objid "LPX64" subobj "LPX64
+ " on OST idx %d: rc = %d\n", lsm->lsm_object_id,
+ loi->loi_id, loi->loi_ost_idx, rc);
+ }
+ RETURN(rc);
+}
+
static int lov_statfs(struct lustre_handle *conn, struct obd_statfs *osfs)
{
struct obd_export *export = class_conn2export(conn);
o_brw: lov_brw,
o_punch: lov_punch,
o_enqueue: lov_enqueue,
- o_cancel: lov_cancel
+ o_cancel: lov_cancel,
+ o_cancel_unused: lov_cancel_unused
};
RETURN(0);
}
+static int osc_cancel_unused(struct lustre_handle *connh,
+ struct lov_stripe_md *lsm)
+{
+ struct obd_device *obddev = class_conn2obd(connh);
+ __u64 res_id[RES_NAME_SIZE] = { lsm->lsm_object_id };
+
+ return ldlm_cli_cancel_unused(obddev->obd_namespace, res_id);
+}
+
static int osc_statfs(struct lustre_handle *conn, struct obd_statfs *osfs)
{
struct ptlrpc_request *request;
o_punch: osc_punch,
o_enqueue: osc_enqueue,
o_cancel: osc_cancel,
+ o_cancel_unused: osc_cancel_unused,
o_iocontrol: osc_iocontrol
};