1
1

Merge pull request #5365 from edgargabriel/topic/fs-cleanup

fs/base: move redundant code to fs/base
Этот коммит содержится в:
Edgar Gabriel 2018-07-01 11:12:08 -05:00 коммит произвёл GitHub
родитель c1ac0c00c5 d191ed6b4f
Коммит 9ecc328710
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
16 изменённых файлов: 51 добавлений и 303 удалений

Просмотреть файл

@ -25,4 +25,9 @@ libmca_fs_la_SOURCES += \
base/fs_base_file_select.c \
base/fs_base_file_unselect.c \
base/fs_base_find_available.c \
base/fs_base_get_parent_dir.c
base/fs_base_get_parent_dir.c \
base/fs_base_file_close.c \
base/fs_base_file_sync.c \
base/fs_base_file_delete.c \
base/fs_base_file_set_size.c \
base/fs_base_file_get_size.c

Просмотреть файл

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -52,6 +52,13 @@ OMPI_DECLSPEC int mca_fs_base_init_file (struct ompio_file_t *file);
OMPI_DECLSPEC int mca_fs_base_get_param (struct ompio_file_t *file, int keyval);
OMPI_DECLSPEC void mca_fs_base_get_parent_dir (char *filename, char **dirnamep);
OMPI_DECLSPEC int mca_fs_base_get_fstype(char *fname);
OMPI_DECLSPEC int mca_fs_base_file_delete (char* file_name, struct opal_info_t *info);
OMPI_DECLSPEC int mca_fs_base_file_sync (ompio_file_t *fh);
OMPI_DECLSPEC int mca_fs_base_file_get_size (ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE *size);
OMPI_DECLSPEC int mca_fs_base_file_set_size (ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE size);
OMPI_DECLSPEC int mca_fs_base_file_close (ompio_file_t *fh);
/*
* Globals
*/

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -21,7 +21,7 @@
#include "ompi_config.h"
#include "fs_ufs.h"
#include "base.h"
#include <fcntl.h>
#include <unistd.h>
@ -36,8 +36,7 @@
* Accepts: - file handle
* Returns: - Success if file closed
*/
int
mca_fs_ufs_file_close (ompio_file_t *fh)
int mca_fs_base_file_close (ompio_file_t *fh)
{
fh->f_comm->c_coll->coll_barrier (fh->f_comm,
fh->f_comm->c_coll->coll_barrier_module);

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
@ -20,7 +20,8 @@
#include "ompi_config.h"
#include "fs_ufs.h"
#include "base.h"
#include <unistd.h>
#include "mpi.h"
@ -34,9 +35,8 @@
* Accepts: - file name & info
* Returns: - Success if file closed
*/
int
mca_fs_ufs_file_delete (char* file_name,
struct opal_info_t *info)
int mca_fs_base_file_delete (char* file_name,
struct opal_info_t *info)
{
int ret;

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -21,8 +21,7 @@
#include "ompi_config.h"
#include "fs_ufs.h"
#include "base.h"
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
@ -34,11 +33,10 @@
*
* Function: - get_size of a file
* Accepts: - same arguments as MPI_File_get_size()
* Returns: - Success if size is get
* Returns: - Success if size is retrieved
*/
int
mca_fs_ufs_file_get_size (ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE *size)
int mca_fs_base_file_get_size (ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE *size)
{
*size = lseek(fh->fd, 0, SEEK_END);
if (-1 == *size) {

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -21,7 +21,7 @@
#include "ompi_config.h"
#include "fs_ufs.h"
#include "base.h"
#include "mpi.h"
#include "ompi/constants.h"
@ -36,8 +36,7 @@
* Accepts: - same arguments as MPI_File_set_size()
* Returns: - Success if size is set
*/
int
mca_fs_ufs_file_set_size (ompio_file_t *fh,
int mca_fs_base_file_set_size (ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE size)
{
int err = 0;

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -21,15 +21,15 @@
#include "ompi_config.h"
#include "fs_ufs.h"
#include "base.h"
#include <unistd.h>
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
int
mca_fs_ufs_file_sync (ompio_file_t *fh)
int mca_fs_base_file_sync (ompio_file_t *fh)
{
int err;

Просмотреть файл

@ -9,7 +9,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2011 University of Houston. All rights reserved.
# Copyright (c) 2008-2018 University of Houston. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
@ -36,12 +36,7 @@ fs_lustre_sources = \
fs_lustre.h \
fs_lustre.c \
fs_lustre_component.c \
fs_lustre_file_open.c \
fs_lustre_file_close.c \
fs_lustre_file_delete.c \
fs_lustre_file_sync.c \
fs_lustre_file_set_size.c \
fs_lustre_file_get_size.c
fs_lustre_file_open.c
AM_CPPFLAGS = $(fs_lustre_CPPFLAGS)

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2017 University of Houston. All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -55,11 +55,11 @@ static mca_fs_base_module_1_0_0_t lustre = {
mca_fs_lustre_module_init, /* initalise after being selected */
mca_fs_lustre_module_finalize, /* close a module on a communicator */
mca_fs_lustre_file_open,
mca_fs_lustre_file_close,
mca_fs_lustre_file_delete,
mca_fs_lustre_file_set_size,
mca_fs_lustre_file_get_size,
mca_fs_lustre_file_sync
mca_fs_base_file_close,
mca_fs_base_file_delete,
mca_fs_base_file_set_size,
mca_fs_base_file_get_size,
mca_fs_base_file_sync
};
/*
* *******************************************************************

Просмотреть файл

@ -1,46 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2017 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "fs_lustre.h"
#include <fcntl.h>
#include <unistd.h>
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_close_lustre
*
* Function: - closes a new file
* Accepts: - file handle
* Returns: - Success if file closed
*/
int
mca_fs_lustre_file_close (ompio_file_t *fh)
{
fh->f_comm->c_coll->coll_barrier (fh->f_comm,
fh->f_comm->c_coll->coll_barrier_module);
close (fh->fd);
return OMPI_SUCCESS;
}

Просмотреть файл

@ -1,49 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "fs_lustre.h"
#include <unistd.h>
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_delete_lustre
*
* Function: - deletes a file
* Accepts: - file name & info
* Returns: - Success if file closed
*/
int
mca_fs_lustre_file_delete (char* file_name,
struct opal_info_t *info)
{
int ret;
ret = unlink(file_name);
if (0 > ret) {
return OMPI_ERROR;
}
return OMPI_SUCCESS;
}

Просмотреть файл

@ -1,52 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "fs_lustre.h"
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_get_size_lustre
*
* Function: - get_size of a file
* Accepts: - same arguments as MPI_File_get_size()
* Returns: - Success if size is get
*/
int
mca_fs_lustre_file_get_size (ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE *size)
{
*size = lseek(fh->fd, 0, SEEK_END);
if (-1 == *size) {
perror ("lseek");
return OMPI_ERROR;
}
if (-1 == (lseek(fh->fd, fh->f_offset, SEEK_SET))) {
perror ("lseek");
return OMPI_ERROR;
}
return OMPI_SUCCESS;
}

Просмотреть файл

@ -1,55 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2017 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "fs_lustre.h"
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_set_size_lustre
*
* Function: - set_size of a file
* Accepts: - same arguments as MPI_File_set_size()
* Returns: - Success if size is set
*/
int
mca_fs_lustre_file_set_size (ompio_file_t *fh,
OMPI_MPI_OFFSET_TYPE size)
{
int err = 0;
err = ftruncate(fh->fd, size);
fh->f_comm->c_coll->coll_bcast (&err,
1,
MPI_INT,
OMPIO_ROOT,
fh->f_comm,
fh->f_comm->c_coll->coll_bcast_module);
if (-1 == err) {
return OMPI_ERROR;
}
return OMPI_SUCCESS;
}

Просмотреть файл

@ -1,49 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2011 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2009 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "fs_lustre.h"
#include <unistd.h>
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
/*
* file_sync_lustre
*
* Function: - closes a new file
* Accepts: - file handle
* Returns: - Success if file closed
*/
int
mca_fs_lustre_file_sync (ompio_file_t *fh)
{
int err;
err = fsync(fh->fd);
if (-1 == err) {
return OMPI_ERROR;
}
return OMPI_SUCCESS;
}

Просмотреть файл

@ -9,7 +9,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2011 University of Houston. All rights reserved.
# Copyright (c) 2008-2018 University of Houston. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
@ -46,9 +46,4 @@ sources = \
fs_ufs.h \
fs_ufs.c \
fs_ufs_component.c \
fs_ufs_file_open.c \
fs_ufs_file_close.c \
fs_ufs_file_delete.c \
fs_ufs_file_sync.c \
fs_ufs_file_set_size.c \
fs_ufs_file_get_size.c
fs_ufs_file_open.c

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2014 University of Houston. All rights reserved.
* Copyright (c) 2008-2018 University of Houston. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -30,6 +30,7 @@
#include "mpi.h"
#include "ompi/mca/fs/fs.h"
#include "ompi/mca/fs/ufs/fs_ufs.h"
#include "ompi/mca/fs/base/base.h"
/*
* *******************************************************************
@ -40,11 +41,11 @@ static mca_fs_base_module_1_0_0_t ufs = {
mca_fs_ufs_module_init, /* initalise after being selected */
mca_fs_ufs_module_finalize, /* close a module on a communicator */
mca_fs_ufs_file_open,
mca_fs_ufs_file_close,
mca_fs_ufs_file_delete,
mca_fs_ufs_file_set_size,
mca_fs_ufs_file_get_size,
mca_fs_ufs_file_sync
mca_fs_base_file_close,
mca_fs_base_file_delete,
mca_fs_base_file_set_size,
mca_fs_base_file_get_size,
mca_fs_base_file_sync
};
/*
* *******************************************************************