From c400f44da39ab2e5562a7e11c5a2298bf7c72c62 Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Fri, 15 Nov 2013 17:22:57 +0800 Subject: [PATCH] LU-3286 llog: local storage doesn't need vfsmount After introduction of local storage device vfsmount is redundant, and servers don't need this struct to access local storage based llog. * remove lsi_srv_mnt from lustre_sb_info. * remove lmi_mnt from lustre_mount_info. * remove ddp_mnt from dt_device_param. Signed-off-by: Lai Siyao Change-Id: I8cfdda8c871301ec9a332a01fd0a2523fe1a09c2 Reviewed-on: http://review.whamcloud.com/8286 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Mike Pershin Reviewed-by: Jian Yu Tested-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre/include/dt_object.h | 1 - lustre/include/lustre_disk.h | 4 +--- lustre/mdt/mdt_handler.c | 4 ++-- lustre/mgs/mgs_handler.c | 4 ++-- lustre/obdclass/obd_mount_server.c | 43 +++++++++++++++----------------------- lustre/ofd/ofd_dev.c | 2 +- lustre/osd-ldiskfs/osd_handler.c | 1 - lustre/osd-zfs/osd_handler.c | 2 -- 8 files changed, 23 insertions(+), 38 deletions(-) diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index 7e6032d..bdf559d 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -80,7 +80,6 @@ struct dt_device_param { unsigned ddp_block_shift; mntopt_t ddp_mntopts; unsigned ddp_max_ea_size; - void *ddp_mnt; /* XXX: old code can retrieve mnt -bzzz */ int ddp_mount_type; unsigned long long ddp_maxbytes; /* percentage of available space to reserve for grant error margin */ diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index c67d604..8c33316 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -491,7 +491,6 @@ struct lustre_sb_info { struct lustre_mount_data *lsi_lmd; /* mount command info */ struct ll_sb_info *lsi_llsbi; /* add'l client sbi info */ struct dt_device *lsi_dt_dev; /* dt device to access disk fs*/ - struct vfsmount *lsi_srv_mnt; /* the one server mount */ cfs_atomic_t lsi_mounts; /* references to the srv_mnt */ char lsi_svname[MTI_NAME_MAXLEN]; char lsi_osd_obdname[64]; @@ -520,7 +519,6 @@ struct lustre_sb_info { struct lustre_mount_info { char *lmi_name; struct super_block *lmi_sb; - struct vfsmount *lmi_mnt; cfs_list_t lmi_list_chain; }; @@ -548,7 +546,7 @@ int lustre_common_put_super(struct super_block *sb); int server_fill_super(struct super_block *sb); struct lustre_mount_info *server_get_mount(const char *name); struct lustre_mount_info *server_get_mount_2(const char *name); -int server_put_mount(const char *name, struct vfsmount *mnt); +int server_put_mount(const char *name); int server_put_mount_2(const char *name, struct vfsmount *mnt); struct mgs_target_info; int server_mti_print(const char *title, struct mgs_target_info *mti); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index ffad80d..e2344fa 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -4114,7 +4114,7 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m) LASSERT(cfs_atomic_read(&d->ld_ref) == 0); - server_put_mount(mdt_obd_name(m), NULL); + server_put_mount(mdt_obd_name(m)); EXIT; } @@ -4370,7 +4370,7 @@ err_fini_stack: mdt_stack_fini(env, m, md2lu_dev(m->mdt_child)); err_lmi: if (lmi) - server_put_mount(dev, lmi->lmi_mnt); + server_put_mount(dev); return(rc); } diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 50385c3..cb6666c 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -1084,7 +1084,7 @@ err_ops: obd_disconnect(mgs->mgs_bottom_exp); err_lmi: if (lmi) - server_put_mount(lustre_cfg_string(lcfg, 0), lmi->lmi_mnt); + server_put_mount(lustre_cfg_string(lcfg, 0)); RETURN(rc); } @@ -1255,7 +1255,7 @@ static struct lu_device *mgs_device_fini(const struct lu_env *env, LASSERT(mgs->mgs_bottom_exp); obd_disconnect(mgs->mgs_bottom_exp); - server_put_mount(obd->obd_name, NULL); + server_put_mount(obd->obd_name); RETURN(NULL); } diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index d028c37..b617d4c 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -83,8 +83,7 @@ static struct lustre_mount_info *server_find_mount(const char *name) /* we must register an obd for a mount before we call the setup routine. *_setup will call lustre_get_mount to get the mnt struct by obd_name, since we can't pass the pointer to setup. */ -static int server_register_mount(const char *name, struct super_block *sb, - struct vfsmount *mnt) +static int server_register_mount(const char *name, struct super_block *sb) { struct lustre_mount_info *lmi; char *name_cp; @@ -113,12 +112,11 @@ static int server_register_mount(const char *name, struct super_block *sb, } lmi->lmi_name = name_cp; lmi->lmi_sb = sb; - lmi->lmi_mnt = mnt; cfs_list_add(&lmi->lmi_list_chain, &server_mount_info_list); mutex_unlock(&lustre_mount_info_lock); - CDEBUG(D_MOUNT, "reg_mnt %p from %s\n", lmi->lmi_mnt, name); + CDEBUG(D_MOUNT, "register mount %p from %s\n", sb, name); RETURN(0); } @@ -137,7 +135,7 @@ static int server_deregister_mount(const char *name) RETURN(-ENOENT); } - CDEBUG(D_MOUNT, "dereg_mnt %p from %s\n", lmi->lmi_mnt, name); + CDEBUG(D_MOUNT, "deregister mount %p from %s\n", lmi->lmi_sb, name); OBD_FREE(lmi->lmi_name, strlen(lmi->lmi_name) + 1); cfs_list_del(&lmi->lmi_list_chain); @@ -167,7 +165,7 @@ struct lustre_mount_info *server_get_mount(const char *name) cfs_atomic_inc(&lsi->lsi_mounts); - CDEBUG(D_MOUNT, "get_mnt %p from %s, refs=%d\n", lmi->lmi_mnt, + CDEBUG(D_MOUNT, "get mount %p from %s, refs=%d\n", lmi->lmi_sb, name, cfs_atomic_read(&lsi->lsi_mounts)); RETURN(lmi); @@ -195,7 +193,7 @@ struct lustre_mount_info *server_get_mount_2(const char *name) EXPORT_SYMBOL(server_get_mount_2); /* to be called from obd_cleanup methods */ -int server_put_mount(const char *name, struct vfsmount *mnt) +int server_put_mount(const char *name) { struct lustre_mount_info *lmi; struct lustre_sb_info *lsi; @@ -210,12 +208,12 @@ int server_put_mount(const char *name, struct vfsmount *mnt) } lsi = s2lsi(lmi->lmi_sb); - CDEBUG(D_MOUNT, "put_mnt %p from %s, refs=%d\n", - lmi->lmi_mnt, name, cfs_atomic_read(&lsi->lsi_mounts)); + CDEBUG(D_MOUNT, "put mount %p from %s, refs=%d\n", + lmi->lmi_sb, name, cfs_atomic_read(&lsi->lsi_mounts)); if (lustre_put_lsi(lmi->lmi_sb)) - CDEBUG(D_MOUNT, "Last put of mnt %p from %s\n", - lmi->lmi_mnt, name); + CDEBUG(D_MOUNT, "Last put of mount %p from %s\n", + lmi->lmi_sb, name); /* this obd should never need the mount again */ server_deregister_mount(name); @@ -236,7 +234,6 @@ EXPORT_SYMBOL(server_put_mount_2); static int server_start_mgs(struct super_block *sb) { struct lustre_sb_info *lsi = s2lsi(sb); - struct vfsmount *mnt = lsi->lsi_srv_mnt; struct lustre_mount_info *lmi; int rc = 0; ENTRY; @@ -253,7 +250,7 @@ static int server_start_mgs(struct super_block *sb) CDEBUG(D_CONFIG, "Start MGS service %s\n", LUSTRE_MGS_OBDNAME); - rc = server_register_mount(LUSTRE_MGS_OBDNAME, sb, mnt); + rc = server_register_mount(LUSTRE_MGS_OBDNAME, sb); if (!rc) { rc = lustre_start_simple(LUSTRE_MGS_OBDNAME, LUSTRE_MGS_NAME, @@ -1179,7 +1176,7 @@ out: /** Start server targets: MDTs and OSTs */ -static int server_start_targets(struct super_block *sb, struct vfsmount *mnt) +static int server_start_targets(struct super_block *sb) { struct obd_device *obd; struct lustre_sb_info *lsi = s2lsi(sb); @@ -1230,11 +1227,9 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt) /* Set the mgc fs to our server disk. This allows the MGC to * read and write configs locally, in case it can't talk to the MGS. */ - if (lsi->lsi_srv_mnt) { - rc = server_mgc_set_fs(lsi->lsi_mgc, sb); - if (rc) - GOTO(out_stop_service, rc); - } + rc = server_mgc_set_fs(lsi->lsi_mgc, sb); + if (rc) + GOTO(out_stop_service, rc); /* Register with MGS */ rc = server_register_target(lsi); @@ -1243,7 +1238,7 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt) /* Let the target look up the mount using the target's name (we can't pass the sb or mnt through class_process_config.) */ - rc = server_register_mount(lsi->lsi_svname, sb, mnt); + rc = server_register_mount(lsi->lsi_svname, sb); if (rc) GOTO(out_mgc, rc); @@ -1313,8 +1308,7 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt) out_mgc: /* Release the mgc fs for others to use */ - if (lsi->lsi_srv_mnt) - server_mgc_clear_fs(lsi->lsi_mgc); + server_mgc_clear_fs(lsi->lsi_mgc); out_stop_service: if (rc != 0) @@ -1668,9 +1662,6 @@ static int osd_start(struct lustre_sb_info *lsi, unsigned long mflags) obd->obd_lvfs_ctxt.dt = lsi->lsi_dt_dev; dt_conf_get(NULL, lsi->lsi_dt_dev, &p); - - lsi->lsi_srv_mnt = p.ddp_mnt; - out: RETURN(rc); } @@ -1726,7 +1717,7 @@ int server_fill_super(struct super_block *sb) /* Set up all obd devices for service */ if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOSVC) && (IS_OST(lsi) || IS_MDT(lsi))) { - rc = server_start_targets(sb, lsi->lsi_srv_mnt); + rc = server_start_targets(sb); if (rc < 0) { CERROR("Unable to start targets: %d\n", rc); GOTO(out_mnt, rc); diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 0079ecc..d8196f6 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -1820,7 +1820,7 @@ static void ofd_fini(const struct lu_env *env, struct ofd_device *m) ofd_stack_fini(env, m, &m->ofd_dt_dev.dd_lu_dev); ofd_procfs_fini(m); LASSERT(cfs_atomic_read(&d->ld_ref) == 0); - server_put_mount(obd->obd_name, NULL); + server_put_mount(obd->obd_name); EXIT; } diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 9bbb107..6fafb57 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1153,7 +1153,6 @@ static void osd_conf_get(const struct lu_env *env, /* * XXX should be taken from not-yet-existing fs abstraction layer. */ - param->ddp_mnt = osd_dt_dev(dev)->od_mnt; param->ddp_max_name_len = LDISKFS_NAME_LEN; param->ddp_max_nlink = LDISKFS_LINK_MAX; param->ddp_block_shift = sb->s_blocksize_bits; diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c index f41a9dd..de11dc1 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c @@ -360,8 +360,6 @@ static void osd_conf_get(const struct lu_env *env, param->ddp_inodespace = OSD_DNODE_EST_COUNT; /* per-fragment overhead to be used by the client code */ param->ddp_grant_frag = udmu_blk_insert_cost(); - - param->ddp_mnt = NULL; } /* -- 1.8.3.1