Linux File System Filter
[Client]

Collaboration diagram for Linux File System Filter:

Detailed Description


Files

file  ivdfs_params.c
 The parameters are available as read (or read write) in the /sys/module/hsmfs/parameters.
file  ivdfs_super.h
 All VFS operations can be found within structure super_operations in the file include/linux/fs.h.

Classes

struct  ivd_fs_ops_t
struct  ivd_fs_b_ops_t
struct  ivd_fs_t
struct  ivd_comm_t
struct  ivd_req_entry_t
struct  ivd_inode_info_t
struct  ivd_file_t
struct  ivd_path_t
struct  ivd_req_hdr_t
struct  ivd_req_pre_mount_t
struct  ivd_req_mount_t
struct  ivd_req_pre_umount_t
struct  ivd_req_umount_t
struct  ivd_req_open_t
struct  ivd_req_release_t
struct  ivd_req_chg_name_t
struct  ivd_req_chg_data_t
struct  ivd_req_chg_attr_t
struct  ivd_req_data_offl_t
struct  ivd_req_cancel_req_t
struct  ivd_req_log_error_t
union  ivd_req_t
struct  ivd_ioc_opmode_t
struct  ivd_ioc_setfileid_t
 HSM_IOC_GET_FILEID argument for ioctl() call HSM_IOC_SET_FILEID argument for ioctl() call. More...
struct  ivd_ioc_lockfile_t
struct  ivd_ioc_fileinfo_t
 HSM_IOC_GET_FILE_INFO argument for ioctl() call. More...
struct  ivd_ioc_datastate_t
 HSM_IOC_DATA_CLEAN argument for ioctl() call HSM_IOC_DATA_OFFLINE argument for ioctl() call HSM_IOC_DATA_ONLINE argument for ioctl() call. More...
struct  ivd_ioc_triggevent_t
 HSM_IOC_TRIGGER_EVENT argument for ioctrl() call. More...

Defines

#define IVD_OVERRIDE_ALL   1
 Common module compilation defines.
#define HSM_VIRTUAL_INODE_DIR   6
 special INODE for recalling files without DENTRY
#define IVD_BFS_NEEDS_USER_XATTR   0x0001
#define IVD_EF_SYNC   0x0001
#define IVD_EF_REPLY   0x0002
#define IVD_EF_NONBLOCK   0x0010
#define IVD_IIF_DIRTY   ia_F_DIRTY
 IVD Inode Info - record stored in each struct inode (stored in unused part of inode->u structure).
#define IVD_IIF_OFFLINE   ia_F_OFFLINE
#define IVD_IIF_LOCK_MIGRATION   (1 << 15)
#define IVD_IIF_LOCK_RECALL   (1 << 16)
#define IVD_IIF_LOCK_RELEASE   (1 << 17)
#define IVD_IIF_MASTER   (1 << 29)
#define IVD_IIF_CREATED   (1 << 30)
#define IVD_IIF_NEW_ENTRY   (1 << 31)
#define CHECK_INODE_ACCESS(_ic, _inode, _func)
#define CHECK_INODE_ACCESS_MOVE(_ic, _inode, _old_de, _new_de, _func)
#define CHECK_FILE_ACCESS(_ic, _inode, _file, _func)
#define CHECK_FILE_ATTR_DATA(_ic, _inode, _file)
#define MAX_FSTYPES   3
 maximum number of different FS types supported in single kernel
#define MAX_IVDFS   256
 maximum number of mounted hsmfs's
#define FSTYPE_SLEN   20
 maximum length of FS type string, i.e. ext3, reiserfs, intermezzo..
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 min/max helpers
#define max(a, b)   (((a) > (b)) ? (a) : (b))
#define __TO_STR(x)   #x
 stringification macro
#define TO_STR(x)   __TO_STR(x)
#define DBG_MAIN   (1 << 0)
 main filter execution flow
#define DBG_FILTER   (1 << 1)
 file system filter
#define DBG_VFS   (1 << 2)
 tracing of VFS methods (all except page cache)
#define DBG_COMM   (1 << 3)
 pseudo device communication
#define DBG_EVT   (1 << 4)
 logging of events
#define DBG_II   (1 << 5)
 Inode info/HSM attributes.
#define DBG_LOCK   (1 << 6)
 locking
#define DBG_VFS_PAGE   (1 << 18)
 tracing of VFS methods (page cache)
#define DBG_COMM_DETAIL   (1 << 19)
 pseudo device communication - detail tracing
#define DBG_EVT_DETAIL   (1 << 20)
 logging of events - detail event structure dump
#define DBG_II_DETAIL   (1 << 21)
 Inode info/HSM attributes - detail tracing.
#define DBG_LOCK_DETAIL   (1 << 22)
 locking - detail tracing
#define DBG_INV_IO   (1 << 30)
 tracing of Invisible IO (all operations that are hidden)
#define DBG_VFS_ALL   (1 << 31)
 tracing of all VFS methods (even those that are not needed)
#define ivd_dbg(_lvl, _fmt, _arg...)
#define ivd_alert(_fmt, _arg...)   printk(KERN_ALERT "%s: " _fmt "\n", "hsmfs", ## _arg)
#define ivd_err(_fmt, _arg...)   printk(KERN_ERR "%-23s ERR: " _fmt "\n", __FUNCTION__, ## _arg)
#define ivd_warn(_fmt, _arg...)   printk(KERN_WARNING "%-23s WARN: " _fmt "\n", __FUNCTION__, ## _arg)
#define ivd_info(_fmt, _arg...)   printk(KERN_INFO "%s: " _fmt "\n", "hsmfs", ## _arg)
#define EIVDBUSY   EBUSY
#define IVD_MALLOC(ptr, cast, size)
 malloc/free
#define IVD_FREE(ptr)
#define ivd_ii(_inode)   ((ivd_inode_info_t *)(_inode->i_private))
#define IVD_EVT_HDR(_req, _evt, _dev)
#define OVERRIDE(_ivd_ops, _op, _func)
#define ivdfs_hsmattr_init(_ia)   memset(_ia, 0, sizeof(ivd_hsmattr_t))
 Initialize HSM attributes.
#define IVD_ISEM_HELD   0x0001
 Flags for locking and sending events.
#define IVD_DONT_WRITE   0x0002
#define IVD_KEEP_TIME   0x0004
#define ivdfs_is_offline(_inode, _off, _size)   (ivd_ii(_inode)->flags & IVD_IIF_OFFLINE)
 Check if area of file (off, size) is offline (released).
#define ivdfs_is_dirty(_inode, _off, _size)   (ivd_ii(_inode)->flags & IVD_IIF_DIRTY)
 Check if area of file (off, size) is dirty (changed from last migration).
#define HSM_DEVNAME   "hsmfs"
#define MAX_EVT_BUFSIZE   65536
#define MAX_DEVNAME   1024
#define IOPEN_DIR   ".hsmfsInode"
#define IOPEN_DIR_LEN   11
#define IVD_FILE_ID_FS(_ino, _gen)   (((UInt64_t)(_gen) << 32) + (_ino))
 ID of file in filesystem = inode number + generation number.
#define IVD_FILE_INO(_id_fs)   ((UInt32_t)(_id_fs & 0xFFFFFFFF))
#define IVD_FILE_GEN(_id_fs)   ((UInt32_t)(_id_fs >> 32))
#define IVD_PRINT_ID_FS(_id_fs)   IVD_FILE_INO(_id_fs) << " (" << IVD_FILE_GEN(_id_fs) << ")"
#define ROUND_UP(x, n)   (((x)+(n)-1) & ~((n)-1))
#define ALIGN_FILE(x)   ROUND_UP(x,8)
#define HSM_CAUSE_OFFLINE   0
#define HSM_CAUSE_RECALL   1
#define HSM_CAUSE_MIGRATE   2
#define HSM_EVT_UNKNOWN   0
 IVD request/event types.
#define HSM_EVT_PRE_MOUNT   1
 mount of ivdfs requested [sync]
#define HSM_EVT_MOUNT   2
 ivdfs successfully mounted
#define HSM_EVT_PRE_UMOUNT   3
 umount of ivdfs requested [sync]
#define HSM_EVT_UMOUNT   4
 ivdfs successfully umounted
#define HSM_EVT_OPEN   5
 file opened
#define HSM_EVT_RELEASE   6
 file released (last close)
#define HSM_EVT_CHG_NAME   7
 Change of name (create/rename/move/remove).
#define HSM_EVT_CHG_DATA   8
 Change of file data.
#define HSM_EVT_CHG_ATTR   9
 Change of file attributes.
#define HSM_EVT_CHG_META   10
 Change of file meta data (EA, ACL...).
#define HSM_EVT_DATA_OFFL   11
 Data of file is offline - recall required [sync].
#define HSM_EVT_CANCEL_REQ   12
 Cancel timeouted sync request.
#define HSM_EVT_LOG_ERROR   13
 Write error to log file.
#define HSM_OPMODE_REGULAR   0
 HSM_IOC_SET_OPMODE argument for ioctl() call.
#define HSM_OPMODE_WORM   1
#define HSM_OPMODE_READ_ONLY_NO_RECALL   2
#define HSM_OP_MIGRATION   1
 HSM_IOC_LOCK_FILE argument for ioctl() call HSM_IOC_UNLOCK_FILE argument for ioctl() call.
#define HSM_OP_RELEASE   2
#define HSM_IOC_MOD_COUNT   _IOW('I', 0x00, int)
 IVDFS ioctl() commands.
#define HSM_IOC_SET_DEBUG   _IOW('I', 0x01, unsigned short)
 Set debuging of FS Filter.
#define HSM_IOC_SET_TIMEOUT   _IOW('I', 0x02, unsigned short)
 Set timeout for syncronous events (in seconds).
#define HSM_IOC_DUMP_STATE   _IOW('I', 0x03, int)
 Dump current internal state of ivdfs.
#define HSM_IOC_SET_OPMODE   _IOW('I', 0x04, ivd_ioc_opmode_t *)
 Set operation mode regular/WORM/read-only-no-recall.
#define HSM_IOC_SET_INVIO_PID   _IOW('I', 0x05, int)
 Set PID for InvIO.
#define HSM_IOC_GET_FILEID   _IOW('I', 0x10, ivd_ioc_setfileid_t *)
 Get FileID and chunk size for existing file/dir/symlink.
#define HSM_IOC_SET_FILEID   _IOW('I', 0x11, ivd_ioc_setfileid_t *)
 Set FileID and chunk size for newly created file/dir/symlink.
#define HSM_IOC_LOCK_FILE   _IOW('I', 0x12, ivd_ioc_lockfile_t *)
 Lock file for migration/release.
#define HSM_IOC_UNLOCK_FILE   _IOW('I', 0x13, ivd_ioc_lockfile_t *)
 Unlock file for migration/release.
#define HSM_IOC_GET_FILE_INFO   _IOW('I', 0x14, ivd_ioc_fileinfo_t *)
 Get file information - EA.
#define HSM_IOC_DATA_CLEAN   _IOW('I', 0x20, ivd_ioc_datastate_t *)
 File data is clean (after migration).
#define HSM_IOC_DATA_OFFLINE   _IOW('I', 0x21, ivd_ioc_datastate_t *)
 File data is offline (after release).
#define HSM_IOC_DATA_ONLINE   _IOW('I', 0x22, ivd_ioc_datastate_t *)
 File data is online (after recall).
#define HSM_IOC_TRIGGER_EVENT   _IOW('I', 0x30, ivd_ioc_triggevent_t *)
 Force recall/migrate.
#define HSM_OK_REPLY_d   0
 OK status for replying.
#define HSM_ERR_REPLY_d   1
 ERROR status for replying.
#define HSM_ERR_HSM_CLOSED_d   2
 ERROR HSM released comm, but partition mounted.
#define HSM_ERR_BOTTOM_MOUNT_d   3
 ERROR could not mount bottom file system.
#define HSM_WRN_HSM_BUSY_d   4
 WARNING HSM stoped or slowed read comm, but partition mounted.
#define ivdfs_MAX_HSM_BUSY_d   10
#define ivdfs_SLEEP_FACTOR_d   200
#define ivdfs_MAX_SLEEP_TIME_d   2
#define ivdfs_IMPORT_DELAY_d   1
#define ivdfs_CHG_DATA_INTERVAL_d   1
#define ivdfs_EVENT_ALERT_d   50000
#define ivdfs_PATH_BUFSIZE_d   (2*PAGE_SIZE)
#define ivdfs_NEW_ON_OPEN_NONE_d   0
#define ivdfs_NEW_ON_OPEN_FILES_d   1
#define ivdfs_NEW_ON_OPEN_ALL_d   2
#define HSM_DEVNAME   "hsmfs"
#define MAX_EVT_BUFSIZE   65536
#define MAX_DEVNAME   1024
#define IOPEN_DIR   ".hsmfsInode"
#define IOPEN_DIR_LEN   11
#define IVD_FILE_ID_FS(_ino, _gen)   (((UInt64_t)(_gen) << 32) + (_ino))
 ID of file in filesystem = inode number + generation number.
#define IVD_FILE_INO(_id_fs)   ((UInt32_t)(_id_fs & 0xFFFFFFFF))
#define IVD_FILE_GEN(_id_fs)   ((UInt32_t)(_id_fs >> 32))
#define IVD_PRINT_ID_FS(_id_fs)   IVD_FILE_INO(_id_fs) << " (" << IVD_FILE_GEN(_id_fs) << ")"
#define ROUND_UP(x, n)   (((x)+(n)-1) & ~((n)-1))
#define ALIGN_FILE(x)   ROUND_UP(x,8)
#define HSM_CAUSE_OFFLINE   0
#define HSM_CAUSE_RECALL   1
#define HSM_CAUSE_MIGRATE   2
#define HSM_EVT_UNKNOWN   0
 IVD request/event types.
#define HSM_EVT_PRE_MOUNT   1
 mount of ivdfs requested [sync]
#define HSM_EVT_MOUNT   2
 ivdfs successfully mounted
#define HSM_EVT_PRE_UMOUNT   3
 umount of ivdfs requested [sync]
#define HSM_EVT_UMOUNT   4
 ivdfs successfully umounted
#define HSM_EVT_OPEN   5
 file opened
#define HSM_EVT_RELEASE   6
 file released (last close)
#define HSM_EVT_CHG_NAME   7
 Change of name (create/rename/move/remove).
#define HSM_EVT_CHG_DATA   8
 Change of file data.
#define HSM_EVT_CHG_ATTR   9
 Change of file attributes.
#define HSM_EVT_CHG_META   10
 Change of file meta data (EA, ACL...).
#define HSM_EVT_DATA_OFFL   11
 Data of file is offline - recall required [sync].
#define HSM_EVT_CANCEL_REQ   12
 Cancel timeouted sync request.
#define HSM_EVT_LOG_ERROR   13
 Write error to log file.
#define HSM_OPMODE_REGULAR   0
 HSM_IOC_SET_OPMODE argument for ioctl() call.
#define HSM_OPMODE_WORM   1
#define HSM_OPMODE_READ_ONLY_NO_RECALL   2
#define HSM_OP_MIGRATION   1
 HSM_IOC_LOCK_FILE argument for ioctl() call HSM_IOC_UNLOCK_FILE argument for ioctl() call.
#define HSM_OP_RELEASE   2
#define HSM_IOC_MOD_COUNT   _IOW('I', 0x00, int)
 IVDFS ioctl() commands.
#define HSM_IOC_SET_DEBUG   _IOW('I', 0x01, unsigned short)
 Set debuging of FS Filter.
#define HSM_IOC_SET_TIMEOUT   _IOW('I', 0x02, unsigned short)
 Set timeout for syncronous events (in seconds).
#define HSM_IOC_DUMP_STATE   _IOW('I', 0x03, int)
 Dump current internal state of ivdfs.
#define HSM_IOC_SET_OPMODE   _IOW('I', 0x04, ivd_ioc_opmode_t *)
 Set operation mode regular/WORM/read-only-no-recall.
#define HSM_IOC_SET_INVIO_PID   _IOW('I', 0x05, int)
 Set PID for InvIO.
#define HSM_IOC_GET_FILEID   _IOW('I', 0x10, ivd_ioc_setfileid_t *)
 Get FileID and chunk size for existing file/dir/symlink.
#define HSM_IOC_SET_FILEID   _IOW('I', 0x11, ivd_ioc_setfileid_t *)
 Set FileID and chunk size for newly created file/dir/symlink.
#define HSM_IOC_LOCK_FILE   _IOW('I', 0x12, ivd_ioc_lockfile_t *)
 Lock file for migration/release.
#define HSM_IOC_UNLOCK_FILE   _IOW('I', 0x13, ivd_ioc_lockfile_t *)
 Unlock file for migration/release.
#define HSM_IOC_GET_FILE_INFO   _IOW('I', 0x14, ivd_ioc_fileinfo_t *)
 Get file information - EA.
#define HSM_IOC_DATA_CLEAN   _IOW('I', 0x20, ivd_ioc_datastate_t *)
 File data is clean (after migration).
#define HSM_IOC_DATA_OFFLINE   _IOW('I', 0x21, ivd_ioc_datastate_t *)
 File data is offline (after release).
#define HSM_IOC_DATA_ONLINE   _IOW('I', 0x22, ivd_ioc_datastate_t *)
 File data is online (after recall).
#define HSM_IOC_TRIGGER_EVENT   _IOW('I', 0x30, ivd_ioc_triggevent_t *)
 Force recall/migrate.
#define HSM_OK_REPLY_d   0
 OK status for replying.
#define HSM_ERR_REPLY_d   1
 ERROR status for replying.
#define HSM_ERR_HSM_CLOSED_d   2
 ERROR HSM released comm, but partition mounted.
#define HSM_ERR_BOTTOM_MOUNT_d   3
 ERROR could not mount bottom file system.
#define HSM_WRN_HSM_BUSY_d   4
 WARNING HSM stoped or slowed read comm, but partition mounted.

Typedefs

typedef uint8_t UInt8_t
 define IVD specific types
typedef uint16_t UInt16_t
typedef uint32_t UInt32_t
typedef uint64_t UInt64_t
typedef int8_t Int8_t
typedef int16_t Int16_t
typedef int32_t Int32_t
typedef int64_t Int64_t

Functions

static int ivdfs_bad_cookie (ivd_inode_info_t *ii)
struct inode * hsmfs_iget (struct super_block *sb, unsigned long ino)
int ivdfs_readpage (struct file *filp, struct page *page)
int ivdfs_readpages (struct file *filp, struct address_space *mapping, struct list_head *pages, unsigned nr_pages)
int ivdfs_writepage (struct page *page, struct writeback_control *wbc)
int ivdfs_writepages (struct address_space *mapping, struct writeback_control *wbc)
int ivdfs_prepare_write (struct file *filp, struct page *page, unsigned from, unsigned to)
int ivdfs_commit_write (struct file *filp, struct page *page, unsigned from, unsigned to)
void ivdfs_sync_page (struct page *page)
int ivdfs_releasepage (struct page *page, gfp_t gfp)
sector_t ivdfs_bmap (struct address_space *mapping, sector_t sect)
int ivdfs_set_page_dirty (struct page *page)
void ivdfs_invalidatepage (struct page *page, unsigned long offset)
ssize_t ivdfs_direct_IO (int rw, struct kiocb *kiocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs)
static int ivdfs_comm_wait_reply (ivd_comm_t *ic, ivd_req_entry_t *re)
int ivdfs_comm_add_req (ivd_comm_t *ic, ivd_req_t *req, int reqsize, unsigned int flags)
static ssize_t ivdfs_dev_read (struct file *file, char __user *buf, size_t nbytes, loff_t *off)
static ssize_t ivdfs_dev_write (struct file *file, const char __user *buf, size_t nbytes, loff_t *off)
static unsigned int ivdfs_dev_poll (struct file *file, struct poll_table_struct *wait)
static int ivdfs_dev_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
static int ivdfs_dev_open (struct inode *inode, struct file *file)
static int ivdfs_dev_release (struct inode *inode, struct file *file)
void ivd_initialize_comm (ivd_comm_t *ic)
void ivd_cleanup_comm (ivd_comm_t *ic)
ivd_comm_tivd_get_comm (dev_t dev)
void ivd_put_comm (ivd_comm_t *ic)
ivd_comm_tivd_find_comm (dev_t dev)
int ivdfs_setopmode (ivd_comm_t *ic, UInt16_t opmode, UInt16_t timeout)
void ivd_comm_dump_state (void)
int ivdfs_comm_init (void)
void ivdfs_comm_exit (void)
static int ivdfs_get_path (struct dentry *de, char *buf, int buflen)
int ivdfs_evt_pre_mount (ivd_comm_t *ic, dev_t dev, unsigned short comm_minor, const char *dev_name)
int ivdfs_evt_cancel_req (ivd_comm_t *ic, int reqid)
int ivdfs_evt_mount (ivd_comm_t *ic, dev_t fs_device, const char *dev_name, int code)
int ivdfs_evt_umount (ivd_comm_t *ic, struct super_block *sb)
int ivdfs_evt_open (struct file *file)
int ivdfs_evt_release (struct file *file)
int ivdfs_evt_chg_name (struct dentry *de, struct dentry *de_old)
int ivdfs_evt_chg_data (struct inode *inode, loff_t off, size_t size)
int ivdfs_evt_chg_attr (struct dentry *de)
int ivdfs_evt_data_offl (struct dentry *de, loff_t off, size_t size, int cause)
int ivdfs_evt_log_error (int code, ivd_comm_t *ic)
void ivdfs_evt_simulate_create (struct dentry *de)
int ivdfs_file_open (struct inode *inode, struct file *file)
int ivdfs_file_release (struct inode *inode, struct file *file)
int ivdfs_file_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
ssize_t ivdfs_file_write (struct file *file, const char __user *buf, size_t size, loff_t *offset)
ssize_t ivdfs_file_read (struct file *file, char __user *buf, size_t size, loff_t *offset)
ssize_t ivdfs_file_aio_read (struct kiocb *kiocb, const struct iovec *iovec, unsigned long size, loff_t offset)
ssize_t ivdfs_file_aio_write (struct kiocb *kiocb, const struct iovec *iovec, unsigned long size, loff_t offset)
int ivdfs_file_mmap (struct file *file, struct vm_area_struct *vma)
int ivdfs_file_fsync (struct file *file, struct dentry *de, int datasync)
int ivdfs_file_fasync (int fd, struct file *file, int on)
int ivdfs_file_aio_fsync (struct kiocb *kiocb, int datasync)
int ivdfs_file_flush (struct file *file, fl_owner_t id)
int ivdfs_file_lock (struct file *file, int cmd, struct file_lock *file_lock)
int ivdfs_file_flock (struct file *file, int cmd, struct file_lock *file_lock)
ssize_t ivdfs_file_sendpage (struct file *file, struct page *page, int offset, size_t size, loff_t *pos, int more)
unsigned long ivdfs_file_get_unmapped_area (struct file *file, unsigned long addr, unsigned long len, unsigned long offset, unsigned long flags)
int ivdfs_file_dir_notify (struct file *file, unsigned long arg)
ivd_fs_tivd_get_fs (char *fstype)
void ivd_put_fs (ivd_fs_t *fs)
void ivdfs_set_super_ops (ivd_fs_t *fs, struct super_block *sb)
static void ivdfs_set_d_inode_ops (ivd_fs_t *fs, struct inode *inode)
static void ivdfs_set_f_inode_ops (ivd_fs_t *fs, struct inode *inode)
static void ivdfs_set_d_file_ops (ivd_fs_t *fs, struct inode *inode)
static void ivdfs_set_f_file_ops (ivd_fs_t *fs, struct inode *inode)
static void ivdfs_set_f_addrs_ops (ivd_fs_t *fs, struct inode *inode)
int ivdfs_set_inode_ops (ivd_comm_t *ic, struct inode *inode)
void ivdfs_init_inode_info (struct inode *inode, int flags)
void ivdfs_read_inode_info (struct inode *inode, int flags)
void ivdfs_write_inode_info (struct inode *inode, int flags)
int ivdfs_mark_offline (struct inode *inode, loff_t off, loff_t pos, int flags)
void ivdfs_mark_online (struct inode *inode, loff_t off, loff_t pos, int flags)
int ivdfs_mark_dirty (struct inode *inode, loff_t off, loff_t pos, int flags)
void ivdfs_mark_clean (struct inode *inode, loff_t off, loff_t pos, int flags)
int ivdfs_get_fileid (ivd_comm_t *ic, UInt64_t id_fs, UInt64_t *file_id, UInt64_t *chunk_size)
int ivdfs_set_fileid (ivd_comm_t *ic, UInt64_t id_fs, UInt64_t file_id, UInt64_t chunk_size)
int ivdfs_get_fileinfo (ivd_comm_t *ic, unsigned long ino, ivd_ioc_fileinfo_t *fi)
int ivdfs_lock_file (ivd_comm_t *ic, unsigned int cmd, UInt64_t id_fs, UInt64_t file_id, UInt32_t op, UInt32_t *chg_time, UInt64_t *chunk_size, UInt32_t *flags)
int ivdfs_data_state (ivd_comm_t *ic, unsigned int cmd, UInt64_t id_fs, UInt64_t file_id, UInt64_t chunk_size, UInt64_t chunk_offset, UInt32_t mod_time)
int ivdfs_is_worm_protected (struct inode *inode)
void ivdfs_set_close_time (struct inode *inode, struct timespec time)
int ivdfs_trigger_event (ivd_comm_t *ic, unsigned int evt, UInt64_t id_fs, UInt64_t chunk_size, UInt64_t chunk_offset)
int ivdfs_attach (ivd_comm_t *ic, struct inode *inode)
struct dentry * ivdfs_lookup (struct inode *dir, struct dentry *dentry, struct nameidata *nd)
int ivdfs_create (struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
int ivdfs_link (struct dentry *old_de, struct inode *dir, struct dentry *de)
int ivdfs_unlink (struct inode *dir, struct dentry *de)
int ivdfs_symlink (struct inode *dir, struct dentry *de, const char *symname)
int ivdfs_mkdir (struct inode *dir, struct dentry *de, int mode)
int ivdfs_rmdir (struct inode *dir, struct dentry *de)
int ivdfs_mknod (struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
int ivdfs_rename (struct inode *old_dir, struct dentry *old_de, struct inode *new_dir, struct dentry *new_de)
int ivdfs_setattr (struct dentry *de, struct iattr *attr)
void ivdfs_truncate (struct inode *inode)
int ivdfs_readlink (struct dentry *de, char __user *buf, int buflen)
void ivdfs_follow_link (struct dentry *de, struct nameidata *nd)
void ivdfs_put_link (struct dentry *dentry, struct nameidata *nd, void *p)
int ivdfs_permission (struct inode *inode, int mask)
 MODULE_LICENSE ("GPL")
 MODULE_AUTHOR (ivd_COMPANY_NAME_d)
 MODULE_DESCRIPTION (ivd_MODULE_DESC_d" - Version: "TO_STR(ivd_VERSION_MAJOR_d)"."TO_STR(ivd_VERSION_MINOR_d)"."TO_STR(ivd_VERSION_SYS_MAINT_REL_d)"-"TO_STR(ivd_VERSION_BUILDNUM_d)" "ivd_VERSION_LABEL_d)
 MODULE_VERSION (TO_STR(ivd_VERSION_MAJOR_d)"."TO_STR(ivd_VERSION_MINOR_d)"."TO_STR(ivd_VERSION_SYS_MAINT_REL_d)"-"TO_STR(ivd_VERSION_BUILDNUM_d)" ")
static int ivdfs_parse_options (char *options, char *fs)
int ivdfs_get_sb (struct file_system_type *fst, int flags, const char *dev_name, void *data, struct vfsmount *mnt)
 The mount function of the file system.
void ivdfs_kill_sb (struct super_block *sb)
static int __init ivdfs_init (void)
static void __exit ivdfs_exit (void)
 module_init (ivdfs_init)
 module_exit (ivdfs_exit)
 module_param (hsmfs_debug, ulong, S_IRUGO|S_IWUSR)
 MODULE_PARM_DESC (hsmfs_debug,"Debugging flags")
 module_param (hsmfs_dev_major, ushort, S_IRUGO)
 MODULE_PARM_DESC (hsmfs_dev_major,"hsmfs comm device major number (0 = autoselect)")
 module_param (hsmfs_timeout, ushort, S_IRUGO)
 MODULE_PARM_DESC (hsmfs_timeout,"hsmfs comm timeout for synchronous requests (seconds)")
 module_param (hsmfs_max_outstanding, int, S_IRUGO|S_IWUSR)
 MODULE_PARM_DESC (hsmfs_max_outstanding,"max # of outstanding requests per FS (length of the queue)")
 module_param (hsmfs_sleep_factor, int, S_IRUGO|S_IWUSR)
 MODULE_PARM_DESC (hsmfs_sleep_factor,"sleeping factor in wait_jiffies = messages * messages / sleep_factor")
 module_param (hsmfs_max_sleep_time, int, S_IRUGO|S_IWUSR)
 MODULE_PARM_DESC (hsmfs_max_sleep_time,"max sleep time in seconds")
 module_param (hsmfs_max_hsm_busy, int, S_IRUGO)
 MODULE_PARM_DESC (hsmfs_max_hsm_busy,"seconds of HSM inactivity before hsmfs starts writing warnings")
 module_param (hsmfs_import_delay, int, S_IRUGO)
 MODULE_PARM_DESC (hsmfs_import_delay,"delay in hundredth of seconds on first lookup of a file that was created in ext3 when hsmfs was not active")
 module_param (hsmfs_new_on_open, int, S_IRUGO)
 MODULE_PARM_DESC (hsmfs_new_on_open,"new-on-open mode")
 module_param (hsmfs_event_alert, uint, S_IRUGO)
 MODULE_PARM_DESC (hsmfs_event_alert,"report event queue counters when # of events in queue passes multiple of this threshold")
 module_param (hsmfs_path_bufsize, uint, S_IRUGO)
 MODULE_PARM_DESC (hsmfs_path_bufsize,"hsmfs buffer size for pathnames")
 module_param (hsmfs_chg_data_interval, uint, S_IRUGO)
 MODULE_PARM_DESC (hsmfs_chg_data_interval,"hsmfs change data event interval")
static void ivdfs_inode_init (void *foo)
 This is contructor function, which is called for each allocated element in the hsm_ii_cache_p by the slab allocator.
int ivdfs_slab_init ()
void ivdfs_slab_destroy ()
int alloc_hsmfs_inode_info (struct inode *inode)
int free_hsmfs_inode_info (struct inode *inode)
void ivdfs_clear_inode (struct inode *inode)
 This function is called when VFS wants to clear inode.
void ivdfs_put_super (struct super_block *sb)
void ivdfs_dirty_inode (struct inode *inode)
int ivdfs_write_inode (struct inode *inode, int wait)
void ivdfs_delete_inode (struct inode *inode)
void ivdfs_drop_inode (struct inode *inode)
 This function is called when the last access to the inode is dropped, with the inode_lock spinlock held.
void ivdfs_write_super (struct super_block *sb)
void ivdfs_write_super_lockfs (struct super_block *sb)
void ivdfs_unlockfs (struct super_block *sb)
int ivdfs_statfs (struct dentry *de, struct kstatfs *buf)
int ivdfs_remount_fs (struct super_block *sb, int *flags, char *data)
void ivdfs_umount_begin (struct super_block *sb)
void ivdfs_sync_fs (struct super_block *sb, int wait)

Variables

static spinlock_t comm_lock = SPIN_LOCK_UNLOCKED
static ivd_comm_t ivd_comm [MAX_IVDFS]
struct file_operations ivdfs_dev_fops
static spinlock_t supp_fs_lock = SPIN_LOCK_UNLOCKED
static ivd_fs_t ivd_supp_fs []
struct {
   UInt32_t   major
   UInt32_t   minor
   UInt32_t   smr
   UInt32_t   build
   const char *   label
   const char *   moduleVersion
   const char *   buildTime
   const char *   buildSystem
ivdfs_vers
static struct file_system_type hsmfs_fstype
const char *const hsmfs_cookie = "hsmAMLK\0"
 hsmfs magic cookie for inode info.
struct timespec ivd_nul_time = {0, 0}
unsigned long hsmfs_debug = 0
 Module parameters - can be set at insmod time.
unsigned short hsmfs_dev_major = 0
unsigned short hsmfs_timeout = 5*60
int hsmfs_max_outstanding = 50
int hsmfs_sleep_factor = ivdfs_SLEEP_FACTOR_d
int hsmfs_max_sleep_time = ivdfs_MAX_SLEEP_TIME_d
int hsmfs_max_hsm_busy = ivdfs_MAX_HSM_BUSY_d
int hsmfs_import_delay = ivdfs_IMPORT_DELAY_d
int hsmfs_new_on_open = ivdfs_NEW_ON_OPEN_FILES_d
unsigned int hsmfs_event_alert = ivdfs_EVENT_ALERT_d
unsigned int hsmfs_path_bufsize = ivdfs_PATH_BUFSIZE_d
unsigned int hsmfs_chg_data_interval = ivdfs_CHG_DATA_INTERVAL_d
const char *const hsmfs_cookie
 hsmfs magic cookie for inode info.
struct timespec ivd_nul_time
unsigned long hsmfs_debug
 Module parameters - can be set at insmod time.
unsigned short hsmfs_timeout
int hsmfs_max_outstanding
int hsmfs_sleep_factor
int hsmfs_max_sleep_time
int hsmfs_max_hsm_busy
int hsmfs_import_delay
int hsmfs_new_on_open
unsigned short hsmfs_dev_major
unsigned int hsmfs_chg_data_interval
unsigned int hsmfs_event_alert
unsigned int hsmfs_path_bufsize
static struct kmem_cache * hsm_ii_cache_p


Define Documentation

#define __TO_STR (  )     #x

stringification macro

Definition at line 267 of file ivdfs.h.

#define ALIGN_FILE (  )     ROUND_UP(x,8)

Definition at line 54 of file include/ivd/ivdfs_linux.h.

#define ALIGN_FILE (  )     ROUND_UP(x,8)

Definition at line 76 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by GetPathList(), and ivdfs_get_path().

#define CHECK_FILE_ACCESS ( _ic,
_inode,
_file,
_func   ) 

Definition at line 245 of file ivdfs.h.

Referenced by ivdfs_file_open().

#define CHECK_FILE_ATTR_DATA ( _ic,
_inode,
_file   ) 

Definition at line 246 of file ivdfs.h.

Referenced by ivdfs_file_release().

#define CHECK_INODE_ACCESS ( _ic,
_inode,
_func   ) 

Definition at line 243 of file ivdfs.h.

Referenced by ivdfs_rmdir(), ivdfs_setattr(), and ivdfs_unlink().

#define CHECK_INODE_ACCESS_MOVE ( _ic,
_inode,
_old_de,
_new_de,
_func   ) 

Definition at line 244 of file ivdfs.h.

Referenced by ivdfs_rename().

#define DBG_COMM   (1 << 3)

pseudo device communication

Definition at line 278 of file ivdfs.h.

Referenced by ivd_get_comm(), ivd_put_comm(), ivdfs_comm_add_req(), ivdfs_comm_wait_reply(), and ivdfs_dev_read().

#define DBG_COMM_DETAIL   (1 << 19)

#define DBG_EVT   (1 << 4)

#define DBG_EVT_DETAIL   (1 << 20)

#define DBG_FILTER   (1 << 1)

#define DBG_II   (1 << 5)

#define DBG_II_DETAIL   (1 << 21)

#define DBG_INV_IO   (1 << 30)

#define DBG_LOCK   (1 << 6)

locking

Definition at line 284 of file ivdfs.h.

Referenced by ivdfs_lock_file(), and ivdfs_set_fileid().

#define DBG_LOCK_DETAIL   (1 << 22)

locking - detail tracing

Definition at line 295 of file ivdfs.h.

Referenced by ivdfs_lock_file().

#define DBG_MAIN   (1 << 0)

main filter execution flow

Definition at line 272 of file ivdfs.h.

Referenced by ivdfs_dev_ioctl(), ivdfs_evt_data_offl(), and ivdfs_get_sb().

#define DBG_VFS   (1 << 2)

#define DBG_VFS_ALL   (1 << 31)

tracing of all VFS methods (even those that are not needed)

Definition at line 300 of file ivdfs.h.

Referenced by ivdfs_set_d_inode_ops(), ivdfs_set_f_addrs_ops(), ivdfs_set_f_file_ops(), ivdfs_set_f_inode_ops(), and ivdfs_set_super_ops().

#define DBG_VFS_PAGE   (1 << 18)

#define EIVDBUSY   EBUSY

#define FSTYPE_SLEN   20

maximum length of FS type string, i.e. ext3, reiserfs, intermezzo..

Definition at line 256 of file ivdfs.h.

Referenced by ivdfs_get_sb(), and ivdfs_parse_options().

#define HSM_CAUSE_MIGRATE   2

Definition at line 123 of file include/ivd/ivdfs_linux.h.

#define HSM_CAUSE_MIGRATE   2

#define HSM_CAUSE_OFFLINE   0

Definition at line 121 of file include/ivd/ivdfs_linux.h.

#define HSM_CAUSE_OFFLINE   0

#define HSM_CAUSE_RECALL   1

Definition at line 122 of file include/ivd/ivdfs_linux.h.

#define HSM_CAUSE_RECALL   1

#define HSM_DEVNAME   "hsmfs"

Definition at line 19 of file include/ivd/ivdfs_linux.h.

#define HSM_DEVNAME   "hsmfs"

#define HSM_ERR_BOTTOM_MOUNT_d   3

ERROR could not mount bottom file system.

Definition at line 335 of file include/ivd/ivdfs_linux.h.

#define HSM_ERR_BOTTOM_MOUNT_d   3

ERROR could not mount bottom file system.

Definition at line 357 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by FSEvMgrThrd::Run().

#define HSM_ERR_HSM_CLOSED_d   2

ERROR HSM released comm, but partition mounted.

Definition at line 332 of file include/ivd/ivdfs_linux.h.

#define HSM_ERR_HSM_CLOSED_d   2

ERROR HSM released comm, but partition mounted.

Definition at line 354 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_dev_release(), and FSEvMgrThrd::Run().

#define HSM_ERR_REPLY_d   1

ERROR status for replying.

Definition at line 329 of file include/ivd/ivdfs_linux.h.

#define HSM_ERR_REPLY_d   1

#define HSM_EVT_CANCEL_REQ   12

Cancel timeouted sync request.

Definition at line 193 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_CANCEL_REQ   12

Cancel timeouted sync request.

Definition at line 215 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_evt_cancel_req(), and FSEvMgrThrd::Run().

#define HSM_EVT_CHG_ATTR   9

Change of file attributes.

Definition at line 187 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_CHG_ATTR   9

Change of file attributes.

Definition at line 209 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_comm_add_req(), ivdfs_dev_read(), ivdfs_evt_chg_attr(), and ivd_FileSystemAPI::Run().

#define HSM_EVT_CHG_DATA   8

Change of file data.

Definition at line 185 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_CHG_DATA   8

#define HSM_EVT_CHG_META   10

Change of file meta data (EA, ACL...).

Definition at line 189 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_CHG_META   10

Change of file meta data (EA, ACL...).

Definition at line 211 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_comm_add_req(), and ivdfs_dev_read().

#define HSM_EVT_CHG_NAME   7

Change of name (create/rename/move/remove).

Definition at line 183 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_CHG_NAME   7

Change of name (create/rename/move/remove).

Definition at line 205 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_comm_add_req(), ivdfs_dev_read(), ivdfs_evt_chg_name(), and ivd_FileSystemAPI::Run().

#define HSM_EVT_DATA_OFFL   11

Data of file is offline - recall required [sync].

Definition at line 191 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_DATA_OFFL   11

#define HSM_EVT_LOG_ERROR   13

Write error to log file.

Definition at line 195 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_LOG_ERROR   13

Write error to log file.

Definition at line 217 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_evt_log_error(), and FSEvMgrThrd::Run().

#define HSM_EVT_MOUNT   2

ivdfs successfully mounted

Definition at line 171 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_MOUNT   2

ivdfs successfully mounted

Definition at line 193 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_evt_mount(), and ivd_FileSystemAPI::Run().

#define HSM_EVT_OPEN   5

file opened

Definition at line 178 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_OPEN   5

file opened

Definition at line 200 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_evt_open().

#define HSM_EVT_PRE_MOUNT   1

mount of ivdfs requested [sync]

Definition at line 169 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_PRE_MOUNT   1

mount of ivdfs requested [sync]

Definition at line 191 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_evt_pre_mount(), and FSEvMgrThrd::Run().

#define HSM_EVT_PRE_UMOUNT   3

umount of ivdfs requested [sync]

Definition at line 173 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_PRE_UMOUNT   3

umount of ivdfs requested [sync]

Definition at line 195 of file client/fsfilter/linux/ivdfs_linux.h.

#define HSM_EVT_RELEASE   6

file released (last close)

Definition at line 180 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_RELEASE   6

file released (last close)

Definition at line 202 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_evt_release().

#define HSM_EVT_UMOUNT   4

ivdfs successfully umounted

Definition at line 175 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_UMOUNT   4

ivdfs successfully umounted

Definition at line 197 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_evt_umount(), and ivd_FileSystemAPI::Run().

#define HSM_EVT_UNKNOWN   0

IVD request/event types.

unknown - no event

Definition at line 166 of file include/ivd/ivdfs_linux.h.

#define HSM_EVT_UNKNOWN   0

IVD request/event types.

unknown - no event

Definition at line 188 of file client/fsfilter/linux/ivdfs_linux.h.

#define HSM_IOC_DATA_CLEAN   _IOW('I', 0x20, ivd_ioc_datastate_t *)

File data is clean (after migration).

Definition at line 313 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_DATA_CLEAN   _IOW('I', 0x20, ivd_ioc_datastate_t *)

File data is clean (after migration).

Definition at line 335 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_data_state(), ivdfs_dev_ioctl(), and ivd_FS_File::SetDataClean().

#define HSM_IOC_DATA_OFFLINE   _IOW('I', 0x21, ivd_ioc_datastate_t *)

File data is offline (after release).

Definition at line 316 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_DATA_OFFLINE   _IOW('I', 0x21, ivd_ioc_datastate_t *)

File data is offline (after release).

Definition at line 338 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_data_state(), ivdfs_dev_ioctl(), and ivd_FS_File::SetDataOffline().

#define HSM_IOC_DATA_ONLINE   _IOW('I', 0x22, ivd_ioc_datastate_t *)

File data is online (after recall).

Definition at line 319 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_DATA_ONLINE   _IOW('I', 0x22, ivd_ioc_datastate_t *)

File data is online (after recall).

Definition at line 341 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_data_state(), ivdfs_dev_ioctl(), and ivd_FS_File::SetDataOnline().

#define HSM_IOC_DUMP_STATE   _IOW('I', 0x03, int)

Dump current internal state of ivdfs.

Definition at line 289 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_DUMP_STATE   _IOW('I', 0x03, int)

Dump current internal state of ivdfs.

Definition at line 311 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by DumpIvdFsState(), and ivdfs_dev_ioctl().

#define HSM_IOC_GET_FILE_INFO   _IOW('I', 0x14, ivd_ioc_fileinfo_t *)

Get file information - EA.

Definition at line 310 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_GET_FILE_INFO   _IOW('I', 0x14, ivd_ioc_fileinfo_t *)

Get file information - EA.

Definition at line 332 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivd_FS_File::GetProperties(), and ivdfs_dev_ioctl().

#define HSM_IOC_GET_FILEID   _IOW('I', 0x10, ivd_ioc_setfileid_t *)

Get FileID and chunk size for existing file/dir/symlink.

Definition at line 298 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_GET_FILEID   _IOW('I', 0x10, ivd_ioc_setfileid_t *)

Get FileID and chunk size for existing file/dir/symlink.

Definition at line 320 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_dev_ioctl().

#define HSM_IOC_LOCK_FILE   _IOW('I', 0x12, ivd_ioc_lockfile_t *)

Lock file for migration/release.

Definition at line 304 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_LOCK_FILE   _IOW('I', 0x12, ivd_ioc_lockfile_t *)

Lock file for migration/release.

Definition at line 326 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_dev_ioctl(), and ivdfs_lock_file().

#define HSM_IOC_MOD_COUNT   _IOW('I', 0x00, int)

IVDFS ioctl() commands.

Increment/decrement ivdfs module usage count

Definition at line 280 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_MOD_COUNT   _IOW('I', 0x00, int)

IVDFS ioctl() commands.

Increment/decrement ivdfs module usage count

Definition at line 302 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_dev_ioctl().

#define HSM_IOC_SET_DEBUG   _IOW('I', 0x01, unsigned short)

Set debuging of FS Filter.

Definition at line 283 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_SET_DEBUG   _IOW('I', 0x01, unsigned short)

#define HSM_IOC_SET_FILEID   _IOW('I', 0x11, ivd_ioc_setfileid_t *)

Set FileID and chunk size for newly created file/dir/symlink.

Definition at line 301 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_SET_FILEID   _IOW('I', 0x11, ivd_ioc_setfileid_t *)

Set FileID and chunk size for newly created file/dir/symlink.

Definition at line 323 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_dev_ioctl(), and ivd_FS_File::SetFileID().

#define HSM_IOC_SET_INVIO_PID   _IOW('I', 0x05, int)

Set PID for InvIO.

Definition at line 295 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_SET_INVIO_PID   _IOW('I', 0x05, int)

Set PID for InvIO.

Definition at line 317 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivd_FileSystemAPI::ivd_FileSystemAPI(), and ivdfs_dev_ioctl().

#define HSM_IOC_SET_OPMODE   _IOW('I', 0x04, ivd_ioc_opmode_t *)

Set operation mode regular/WORM/read-only-no-recall.

Definition at line 292 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_SET_OPMODE   _IOW('I', 0x04, ivd_ioc_opmode_t *)

Set operation mode regular/WORM/read-only-no-recall.

Definition at line 314 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_dev_ioctl(), and ivd_FileSystemAPI::SetConfiguration().

#define HSM_IOC_SET_TIMEOUT   _IOW('I', 0x02, unsigned short)

Set timeout for syncronous events (in seconds).

Definition at line 286 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_SET_TIMEOUT   _IOW('I', 0x02, unsigned short)

Set timeout for syncronous events (in seconds).

Definition at line 308 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_dev_ioctl(), and ivd_FileSystemAPI::SetConfiguration().

#define HSM_IOC_TRIGGER_EVENT   _IOW('I', 0x30, ivd_ioc_triggevent_t *)

Force recall/migrate.

Definition at line 322 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_TRIGGER_EVENT   _IOW('I', 0x30, ivd_ioc_triggevent_t *)

Force recall/migrate.

Definition at line 344 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_dev_ioctl(), and ivd_FS_File::TriggerEvent().

#define HSM_IOC_UNLOCK_FILE   _IOW('I', 0x13, ivd_ioc_lockfile_t *)

Unlock file for migration/release.

Definition at line 307 of file include/ivd/ivdfs_linux.h.

#define HSM_IOC_UNLOCK_FILE   _IOW('I', 0x13, ivd_ioc_lockfile_t *)

Unlock file for migration/release.

Definition at line 329 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_dev_ioctl(), and ivdfs_lock_file().

#define HSM_OK_REPLY_d   0

OK status for replying.

Definition at line 326 of file include/ivd/ivdfs_linux.h.

#define HSM_OK_REPLY_d   0

OK status for replying.

Definition at line 348 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivd_FS_File::ReplySyncEvents().

#define HSM_OP_MIGRATION   1

HSM_IOC_LOCK_FILE argument for ioctl() call HSM_IOC_UNLOCK_FILE argument for ioctl() call.

Definition at line 227 of file include/ivd/ivdfs_linux.h.

#define HSM_OP_MIGRATION   1

HSM_IOC_LOCK_FILE argument for ioctl() call HSM_IOC_UNLOCK_FILE argument for ioctl() call.

Definition at line 249 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_lock_file().

#define HSM_OP_RELEASE   2

Definition at line 228 of file include/ivd/ivdfs_linux.h.

#define HSM_OP_RELEASE   2

Definition at line 250 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_lock_file().

#define HSM_OPMODE_READ_ONLY_NO_RECALL   2

Definition at line 206 of file include/ivd/ivdfs_linux.h.

#define HSM_OPMODE_READ_ONLY_NO_RECALL   2

Definition at line 228 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_setopmode().

#define HSM_OPMODE_REGULAR   0

HSM_IOC_SET_OPMODE argument for ioctl() call.

Definition at line 204 of file include/ivd/ivdfs_linux.h.

#define HSM_OPMODE_REGULAR   0

HSM_IOC_SET_OPMODE argument for ioctl() call.

Definition at line 226 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivd_get_comm(), ivdfs_get_sb(), and ivdfs_setopmode().

#define HSM_OPMODE_WORM   1

Definition at line 205 of file include/ivd/ivdfs_linux.h.

#define HSM_OPMODE_WORM   1

Definition at line 227 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_setopmode().

#define HSM_VIRTUAL_INODE_DIR   6

special INODE for recalling files without DENTRY

Definition at line 64 of file ivdfs.h.

Referenced by ivdfs_evt_chg_data(), ivdfs_iopen_check(), ivdfs_iopen_get_inode(), ivdfs_set_inode_ops(), and ivdfs_setattr().

#define HSM_WRN_HSM_BUSY_d   4

WARNING HSM stoped or slowed read comm, but partition mounted.

Definition at line 338 of file include/ivd/ivdfs_linux.h.

#define HSM_WRN_HSM_BUSY_d   4

WARNING HSM stoped or slowed read comm, but partition mounted.

Definition at line 360 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_comm_add_req(), and FSEvMgrThrd::Run().

#define IOPEN_DIR   ".hsmfsInode"

Definition at line 24 of file include/ivd/ivdfs_linux.h.

#define IOPEN_DIR   ".hsmfsInode"

Definition at line 46 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by GetInodePathList(), and ivdfs_iopen_check().

#define IOPEN_DIR_LEN   11

Definition at line 25 of file include/ivd/ivdfs_linux.h.

#define IOPEN_DIR_LEN   11

Definition at line 47 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by GetInodePathList(), and ivdfs_iopen_check().

#define ivd_alert ( _fmt,
_arg...   )     printk(KERN_ALERT "%s: " _fmt "\n", "hsmfs", ## _arg)

#define IVD_BFS_NEEDS_USER_XATTR   0x0001

Definition at line 140 of file ivdfs.h.

Referenced by ivdfs_get_sb().

#define ivd_dbg ( _lvl,
_fmt,
_arg...   ) 

Value:

do {                                                                    \
    if ((hsmfs_debug & _lvl))                                           \
        printk(KERN_DEBUG "%lu [%d,%d] %-23s " _fmt "\n", jiffies, current->pid, task_pgrp_nr(current), __FUNCTION__, ## _arg);   \
} while (0)

Definition at line 307 of file ivdfs.h.

Referenced by alloc_hsmfs_inode_info(), free_hsmfs_inode_info(), hsmfs_iget(), iopen_lookup(), ivd_get_comm(), ivd_get_fs(), ivd_put_comm(), ivd_put_fs(), ivdfs_attach(), ivdfs_bmap(), ivdfs_clear_inode(), ivdfs_comm_add_req(), ivdfs_comm_wait_reply(), ivdfs_commit_write(), ivdfs_create(), ivdfs_data_state(), ivdfs_delete_inode(), ivdfs_dev_ioctl(), ivdfs_dev_open(), ivdfs_dev_poll(), ivdfs_dev_read(), ivdfs_dev_release(), ivdfs_dev_write(), ivdfs_direct_IO(), ivdfs_dirty_inode(), ivdfs_drop_inode(), ivdfs_evt_cancel_req(), ivdfs_evt_chg_attr(), ivdfs_evt_chg_data(), ivdfs_evt_chg_name(), ivdfs_evt_data_offl(), ivdfs_evt_log_error(), ivdfs_evt_mount(), ivdfs_evt_open(), ivdfs_evt_pre_mount(), ivdfs_evt_release(), ivdfs_evt_simulate_create(), ivdfs_evt_umount(), ivdfs_file_aio_fsync(), ivdfs_file_aio_read(), ivdfs_file_aio_write(), ivdfs_file_dir_notify(), ivdfs_file_fasync(), ivdfs_file_flock(), ivdfs_file_flush(), ivdfs_file_fsync(), ivdfs_file_get_unmapped_area(), ivdfs_file_ioctl(), ivdfs_file_lock(), ivdfs_file_mmap(), ivdfs_file_open(), ivdfs_file_read(), ivdfs_file_release(), ivdfs_file_sendpage(), ivdfs_file_write(), ivdfs_follow_link(), ivdfs_get_fileid(), ivdfs_get_fileinfo(), ivdfs_get_path(), ivdfs_get_sb(), ivdfs_init_inode_info(), ivdfs_invalidatepage(), ivdfs_iopen_check(), ivdfs_iopen_get_inode(), ivdfs_kill_sb(), ivdfs_link(), ivdfs_lock_file(), ivdfs_lookup(), ivdfs_mark_dirty(), ivdfs_mkdir(), ivdfs_mknod(), ivdfs_permission(), ivdfs_prepare_write(), ivdfs_put_link(), ivdfs_put_super(), ivdfs_read_inode_info(), ivdfs_readlink(), ivdfs_readpage(), ivdfs_readpages(), ivdfs_releasepage(), ivdfs_remount_fs(), ivdfs_rename(), ivdfs_rmdir(), ivdfs_set_fileid(), ivdfs_set_inode_ops(), ivdfs_set_page_dirty(), ivdfs_set_super_ops(), ivdfs_setattr(), ivdfs_slab_destroy(), ivdfs_slab_init(), ivdfs_statfs(), ivdfs_symlink(), ivdfs_sync_page(), ivdfs_trigger_event(), ivdfs_truncate(), ivdfs_umount_begin(), ivdfs_unlink(), ivdfs_unlockfs(), ivdfs_write_inode(), ivdfs_write_inode_info(), ivdfs_write_super(), ivdfs_write_super_lockfs(), ivdfs_writepage(), and ivdfs_writepages().

#define IVD_DONT_WRITE   0x0002

Definition at line 39 of file ivdfs_hsmattr.h.

Referenced by ivdfs_init_inode_info().

#define IVD_EF_NONBLOCK   0x0010

Definition at line 207 of file ivdfs.h.

Referenced by ivdfs_comm_add_req(), ivdfs_dev_read(), and ivdfs_evt_umount().

#define IVD_EF_REPLY   0x0002

Definition at line 206 of file ivdfs.h.

Referenced by ivdfs_comm_wait_reply(), and ivdfs_dev_write().

#define IVD_EF_SYNC   0x0001

#define ivd_err ( _fmt,
_arg...   )     printk(KERN_ERR "%-23s ERR: " _fmt "\n", __FUNCTION__, ## _arg)

#define IVD_EVT_HDR ( _req,
_evt,
_dev   ) 

Value:

do {                                \
    _req->hdr.type  = _evt;         \
    _req->hdr.pid   = current->pid; \
    _req->hdr.code  = 0;            \
    _req->hdr.major = MAJOR(_dev);  \
    _req->hdr.minor = MINOR(_dev);  \
} while (0)

Definition at line 121 of file ivdfs_events.c.

Referenced by ivdfs_evt_cancel_req(), ivdfs_evt_chg_attr(), ivdfs_evt_chg_data(), ivdfs_evt_chg_name(), ivdfs_evt_data_offl(), ivdfs_evt_log_error(), ivdfs_evt_mount(), ivdfs_evt_open(), ivdfs_evt_pre_mount(), ivdfs_evt_release(), and ivdfs_evt_umount().

#define IVD_FILE_GEN ( _id_fs   )     ((UInt32_t)(_id_fs >> 32))

Definition at line 34 of file include/ivd/ivdfs_linux.h.

#define IVD_FILE_GEN ( _id_fs   )     ((UInt32_t)(_id_fs >> 32))

#define IVD_FILE_ID_FS ( _ino,
_gen   )     (((UInt64_t)(_gen) << 32) + (_ino))

ID of file in filesystem = inode number + generation number.

Definition at line 32 of file include/ivd/ivdfs_linux.h.

#define IVD_FILE_ID_FS ( _ino,
_gen   )     (((UInt64_t)(_gen) << 32) + (_ino))

ID of file in filesystem = inode number + generation number.

Definition at line 54 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by ivdfs_evt_chg_data(), ivdfs_evt_data_offl(), ivdfs_get_fileinfo(), and ivdfs_get_path().

#define IVD_FILE_INO ( _id_fs   )     ((UInt32_t)(_id_fs & 0xFFFFFFFF))

Definition at line 33 of file include/ivd/ivdfs_linux.h.

#define IVD_FILE_INO ( _id_fs   )     ((UInt32_t)(_id_fs & 0xFFFFFFFF))

#define IVD_FREE ( ptr   ) 

Value:

do {                                                                \
    if (!ptr) {                                                     \
       ivd_err("free of NULL pointer [%s:%d]", __FILE__, __LINE__); \
    }                                                               \
    else {                                                          \
       kfree(ptr);                                                  \
       ptr = NULL;                                                  \
    }                                                               \
} while (0)

Definition at line 341 of file ivdfs.h.

Referenced by ivd_cleanup_comm(), ivdfs_comm_wait_reply(), ivdfs_dev_read(), ivdfs_dev_write(), ivdfs_evt_chg_attr(), ivdfs_evt_chg_data(), ivdfs_evt_chg_name(), ivdfs_evt_data_offl(), ivdfs_evt_open(), and ivdfs_evt_release().

#define ivd_ii ( _inode   )     ((ivd_inode_info_t *)(_inode->i_private))

Definition at line 354 of file ivdfs.h.

Referenced by alloc_hsmfs_inode_info(), free_hsmfs_inode_info(), hsmfs_iget(), iopen_lookup(), ivdfs_bmap(), ivdfs_clear_inode(), ivdfs_commit_write(), ivdfs_create(), ivdfs_data_state(), ivdfs_delete_inode(), ivdfs_direct_IO(), ivdfs_dirty_inode(), ivdfs_drop_inode(), ivdfs_evt_chg_attr(), ivdfs_evt_chg_data(), ivdfs_evt_chg_name(), ivdfs_evt_data_offl(), ivdfs_evt_open(), ivdfs_evt_release(), ivdfs_evt_simulate_create(), ivdfs_file_aio_fsync(), ivdfs_file_aio_read(), ivdfs_file_aio_write(), ivdfs_file_dir_notify(), ivdfs_file_fasync(), ivdfs_file_flock(), ivdfs_file_flush(), ivdfs_file_fsync(), ivdfs_file_get_unmapped_area(), ivdfs_file_ioctl(), ivdfs_file_lock(), ivdfs_file_mmap(), ivdfs_file_open(), ivdfs_file_read(), ivdfs_file_release(), ivdfs_file_sendpage(), ivdfs_file_write(), ivdfs_follow_link(), ivdfs_get_fileid(), ivdfs_get_fileinfo(), ivdfs_get_path(), ivdfs_init_inode_info(), ivdfs_invalidatepage(), ivdfs_iopen_check(), ivdfs_link(), ivdfs_lock_file(), ivdfs_lookup(), ivdfs_mark_clean(), ivdfs_mark_dirty(), ivdfs_mark_offline(), ivdfs_mark_online(), ivdfs_mkdir(), ivdfs_mknod(), ivdfs_permission(), ivdfs_prepare_write(), ivdfs_put_link(), ivdfs_read_inode_info(), ivdfs_readlink(), ivdfs_readpage(), ivdfs_readpages(), ivdfs_releasepage(), ivdfs_remount_fs(), ivdfs_rename(), ivdfs_rmdir(), ivdfs_set_close_time(), ivdfs_set_fileid(), ivdfs_set_inode_ops(), ivdfs_set_page_dirty(), ivdfs_setattr(), ivdfs_statfs(), ivdfs_symlink(), ivdfs_sync_page(), ivdfs_trigger_event(), ivdfs_truncate(), ivdfs_umount_begin(), ivdfs_unlink(), ivdfs_unlockfs(), ivdfs_write_inode(), ivdfs_write_inode_info(), ivdfs_write_super(), ivdfs_write_super_lockfs(), ivdfs_writepage(), and ivdfs_writepages().

#define IVD_IIF_CREATED   (1 << 30)

Definition at line 222 of file ivdfs.h.

Referenced by ivdfs_create().

#define IVD_IIF_DIRTY   ia_F_DIRTY

IVD Inode Info - record stored in each struct inode (stored in unused part of inode->u structure).

Definition at line 214 of file ivdfs.h.

Referenced by ivdfs_file_release(), ivdfs_get_fileinfo(), ivdfs_lock_file(), ivdfs_mark_clean(), ivdfs_mark_dirty(), ivdfs_read_inode_info(), ivdfs_set_fileid(), and ivdfs_truncate().

#define IVD_IIF_LOCK_MIGRATION   (1 << 15)

Definition at line 217 of file ivdfs.h.

#define IVD_IIF_LOCK_RECALL   (1 << 16)

Definition at line 218 of file ivdfs.h.

#define IVD_IIF_LOCK_RELEASE   (1 << 17)

Definition at line 219 of file ivdfs.h.

#define IVD_IIF_MASTER   (1 << 29)

Definition at line 221 of file ivdfs.h.

Referenced by ivdfs_read_inode_info().

#define IVD_IIF_NEW_ENTRY   (1 << 31)

#define IVD_IIF_OFFLINE   ia_F_OFFLINE

#define ivd_info ( _fmt,
_arg...   )     printk(KERN_INFO "%s: " _fmt "\n", "hsmfs", ## _arg)

#define IVD_ISEM_HELD   0x0001

#define IVD_KEEP_TIME   0x0004

Definition at line 40 of file ivdfs_hsmattr.h.

Referenced by ivdfs_file_mmap(), and ivdfs_mark_dirty().

#define IVD_MALLOC ( ptr,
cast,
size   ) 

Value:

do {                                                                \
    ptr = (cast) kmalloc(size, GFP_KERNEL);                         \
    if (!ptr) {                                                     \
       ivd_err("Cannot allocate memory (size=%ld) [%s:%d]",         \
       (long int)size, __FILE__, __LINE__);                         \
       return -ENOMEM;                                              \
    }                                                               \
} while (0)
malloc/free

Definition at line 331 of file ivdfs.h.

Referenced by ivdfs_comm_add_req(), ivdfs_evt_cancel_req(), ivdfs_evt_chg_attr(), ivdfs_evt_chg_data(), ivdfs_evt_chg_name(), ivdfs_evt_data_offl(), ivdfs_evt_log_error(), ivdfs_evt_mount(), ivdfs_evt_open(), ivdfs_evt_pre_mount(), ivdfs_evt_release(), and ivdfs_evt_umount().

#define IVD_OVERRIDE_ALL   1

Common module compilation defines.

Common module compilation defines

Definition at line 59 of file ivdfs.h.

#define IVD_PRINT_ID_FS ( _id_fs   )     IVD_FILE_INO(_id_fs) << " (" << IVD_FILE_GEN(_id_fs) << ")"

Definition at line 36 of file include/ivd/ivdfs_linux.h.

#define IVD_PRINT_ID_FS ( _id_fs   )     IVD_FILE_INO(_id_fs) << " (" << IVD_FILE_GEN(_id_fs) << ")"

Definition at line 58 of file client/fsfilter/linux/ivdfs_linux.h.

Referenced by hsm_ActiveFH::ActiveToList(), fs_api::AddGenericEvent(), hsm_MigByAPI::AllFilesInJobs(), TreeWalk::CheckDir(), MigrateTreewalk::CheckDir(), CheckRootMembersForEA(), hsm_FileHeader::CompleteMigIsDone(), i_HSM_i::CompleteMigration(), hsm_IVDFSRecoverer::CreateFile(), hsm_FileHeader::DecMemberRef(), hsm_InoObj::DecrRef(), hsm_FileHeader::DecrRef(), i_HSM_i::DoMigrationJob(), cmn_TreeWalk::DoWalk(), df_StandardAttr_t::Dump(), hdb_Tables::DumpActiveEntries(), hsm_MigByAPI::DumpInputInode(), hsm_MigByAPI::DumpJobInode(), hsm_FileHeader::DumpListEl(), i_HSM_i::EfficientRecall(), hsm_FileHeader::Event(), fs_api::EventMove(), hsm_FileHeader::FileToSeqElem(), fs_api::FindAndPrepareFH(), i_HSM_i::ForceRelease(), fs_api::GetDirFH(), hsm_FHpVecMgr::GetFH(), GetIdentify(), GetPathList(), hsmGetDirFH(), hsm_FileHeader::IncMemberRef(), hsm_InoObj::IncrRef(), hsm_FileHeader::IncrRef(), hsm_FileHeader::InitActive(), hsm_FHpVecMgr::InsertDirWithTest(), ivd_GetMountPoint(), hsm_FileHeader::MakeStat(), hsm_FileHeader::MigCanToPreJob(), hsm_FHmigc::Migrate(), i_HSM_i::MigrateByAPI(), hsm_FileHeader::MigrationIsDone(), hsm_FileHeader::NewName(), hsm_FileHeader::NewOwner(), hsm_FileHeader::OpenFile(), operator<<(), hsm_ActiveFH::OrphanedToMigList(), i_HSM_i::PackFile(), PathListToPath(), hsm_FHADPRecall::RecallFileFromADP(), hsm_FHpVecMgr::Remove(), hsm_FHpVecMgr::RemoveLastButOne(), ivd_FS_File::SetCollocationId(), hsm_FHdirty::TaskTime(), hsm_DirWaitList::TaskTime(), hsm_FileHeader::ToMigCand(), hsm_FHrelc::Truncate(), hsm_FileHeader::TruncateFile(), and log_ivdfs::Write().

#define ivd_warn ( _fmt,
_arg...   )     printk(KERN_WARNING "%-23s WARN: " _fmt "\n", __FUNCTION__, ## _arg)

#define ivdfs_CHG_DATA_INTERVAL_d   1

Definition at line 39 of file ivdfs_params.h.

Referenced by ivdfs_init().

#define ivdfs_EVENT_ALERT_d   50000

Definition at line 40 of file ivdfs_params.h.

Referenced by ivdfs_init().

#define ivdfs_hsmattr_init ( _ia   )     memset(_ia, 0, sizeof(ivd_hsmattr_t))

Initialize HSM attributes.

Definition at line 54 of file ivdfs_hsmattr.c.

Referenced by ivdfs_init_inode_info(), ivdfs_read_inode_info(), ivdfs_set_fileid(), and ivdfs_write_inode_info().

#define ivdfs_IMPORT_DELAY_d   1

Definition at line 38 of file ivdfs_params.h.

Referenced by ivdfs_init().

#define ivdfs_is_dirty ( _inode,
_off,
_size   )     (ivd_ii(_inode)->flags & IVD_IIF_DIRTY)

Check if area of file (off, size) is dirty (changed from last migration).

Definition at line 50 of file ivdfs_hsmattr.h.

Referenced by ivdfs_data_state(), ivdfs_evt_simulate_create(), ivdfs_lock_file(), and ivdfs_truncate().

#define ivdfs_is_offline ( _inode,
_off,
_size   )     (ivd_ii(_inode)->flags & IVD_IIF_OFFLINE)

#define ivdfs_MAX_HSM_BUSY_d   10

Definition at line 35 of file ivdfs_params.h.

Referenced by ivdfs_init().

#define ivdfs_MAX_SLEEP_TIME_d   2

Definition at line 37 of file ivdfs_params.h.

Referenced by ivdfs_init().

#define ivdfs_NEW_ON_OPEN_ALL_d   2

Definition at line 46 of file ivdfs_params.h.

Referenced by ivdfs_get_path(), ivdfs_init(), and ivdfs_lookup().

#define ivdfs_NEW_ON_OPEN_FILES_d   1

Definition at line 45 of file ivdfs_params.h.

Referenced by ivdfs_init(), and ivdfs_lookup().

#define ivdfs_NEW_ON_OPEN_NONE_d   0

Definition at line 44 of file ivdfs_params.h.

Referenced by ivdfs_file_open(), ivdfs_init(), and ivdfs_lookup().

#define ivdfs_PATH_BUFSIZE_d   (2*PAGE_SIZE)

Definition at line 41 of file ivdfs_params.h.

Referenced by ivdfs_init().

#define ivdfs_SLEEP_FACTOR_d   200

Definition at line 36 of file ivdfs_params.h.

Referenced by ivdfs_init().

#define max ( a,
 )     (((a) > (b)) ? (a) : (b))

#define MAX_DEVNAME   1024

Definition at line 22 of file include/ivd/ivdfs_linux.h.

#define MAX_DEVNAME   1024

Definition at line 44 of file client/fsfilter/linux/ivdfs_linux.h.

#define MAX_EVT_BUFSIZE   65536

Definition at line 21 of file include/ivd/ivdfs_linux.h.

#define MAX_EVT_BUFSIZE   65536

#define MAX_FSTYPES   3

maximum number of different FS types supported in single kernel

Definition at line 249 of file ivdfs.h.

#define MAX_IVDFS   256

maximum number of mounted hsmfs's

Definition at line 253 of file ivdfs.h.

Referenced by ivd_comm_dump_state(), ivd_find_comm(), ivd_get_comm(), ivdfs_comm_init(), and ivdfs_dev_open().

#define min ( a,
 )     (((a) < (b)) ? (a) : (b))

#define OVERRIDE ( _ivd_ops,
_op,
_func   ) 

Value:

{                                                                       \
    if (_ivd_ops->_op)                                                  \
    {                                                                   \
        ivd_dbg(DBG_FILTER, "%p <= %s", _func, TO_STR(_op));            \
        _ivd_ops->_op = _func;                                          \
    }                                                                   \
}

Definition at line 158 of file ivdfs_filter.c.

Referenced by ivdfs_set_d_file_ops(), ivdfs_set_d_inode_ops(), ivdfs_set_f_addrs_ops(), ivdfs_set_f_file_ops(), ivdfs_set_f_inode_ops(), and ivdfs_set_super_ops().

#define ROUND_UP ( x,
 )     (((x)+(n)-1) & ~((n)-1))

Definition at line 53 of file include/ivd/ivdfs_linux.h.

#define ROUND_UP ( x,
 )     (((x)+(n)-1) & ~((n)-1))

Definition at line 75 of file client/fsfilter/linux/ivdfs_linux.h.

#define TO_STR (  )     __TO_STR(x)

Definition at line 268 of file ivdfs.h.


Typedef Documentation

typedef int16_t Int16_t

Definition at line 72 of file ivdfs.h.

typedef int32_t Int32_t

Definition at line 73 of file ivdfs.h.

typedef int64_t Int64_t

Definition at line 74 of file ivdfs.h.

typedef int8_t Int8_t

Definition at line 71 of file ivdfs.h.

typedef uint16_t UInt16_t

Definition at line 68 of file ivdfs.h.

typedef uint32_t UInt32_t

Definition at line 69 of file ivdfs.h.

typedef uint64_t UInt64_t

Definition at line 70 of file ivdfs.h.

typedef uint8_t UInt8_t

define IVD specific types

Definition at line 67 of file ivdfs.h.


Function Documentation

int alloc_hsmfs_inode_info ( struct inode *  inode  ) 

Definition at line 132 of file ivdfs_super.c.

References ivd_inode_info_t::cookie, DBG_II_DETAIL, hsm_ii_cache_p, hsmfs_cookie, ivd_alert, ivd_dbg, ivd_ii, ivdfs_bad_cookie(), and NULL.

Referenced by ivdfs_set_inode_ops().

00133 {
00134     ivd_inode_info_t *hsmfs_ii = ivd_ii(inode);
00135 
00136     ivd_dbg(DBG_II_DETAIL, "ino=%lu (%u)", inode->i_ino, inode->i_generation);
00137     if (hsmfs_ii != NULL) {
00138         if (ivdfs_bad_cookie(hsmfs_ii)) {
00139             ivd_alert(
00140                 "[CRITICAL] inode->u.generic_ip contains non HSMFS data: ino=%lu (%u)",
00141                 inode->i_ino, inode->i_generation);
00142             return -EFAULT;
00143         }
00144         ivd_dbg(DBG_II_DETAIL,
00145             "hsmfs inode info already allocated: ino=%lu (%u)",
00146             inode->i_ino, inode->i_generation);
00147         return 0;
00148     }
00149 
00150     hsmfs_ii = (ivd_inode_info_t *) kmem_cache_alloc(hsm_ii_cache_p, GFP_NOFS);
00151     if (hsmfs_ii == NULL) {
00152         ivd_dbg(DBG_II_DETAIL, "kmem_cache_alloc() failed.");
00153         make_bad_inode(inode);
00154         return -ENOSPC;
00155     }
00156     memset(hsmfs_ii, 0, sizeof(ivd_inode_info_t));
00157     memcpy(hsmfs_ii->cookie, hsmfs_cookie, sizeof(hsmfs_ii->cookie));
00158 
00159     inode->i_private = (void*)(hsmfs_ii);
00160     return 0;
00161 }

Here is the call graph for this function:

Here is the caller graph for this function:

int free_hsmfs_inode_info ( struct inode *  inode  ) 

Definition at line 163 of file ivdfs_super.c.

References DBG_II_DETAIL, hsm_ii_cache_p, ivd_alert, ivd_dbg, ivd_ii, ivdfs_bad_cookie(), and NULL.

Referenced by ivdfs_clear_inode().

00164 {
00165     ivd_inode_info_t *hsmfs_ii = ivd_ii(inode);
00166 
00167     ivd_dbg(DBG_II_DETAIL, "ino=%lu (%u) i_p: 0x%p ii_p: 0x%p",
00168             inode->i_ino,
00169             inode->i_generation,
00170             inode,
00171             hsmfs_ii);
00172 
00173     if (hsmfs_ii == NULL) {
00174         return 0;
00175     }
00176 
00177     if (ivdfs_bad_cookie(hsmfs_ii)) {
00178         ivd_alert(
00179             "[CRITICAL] i->u.generic_ip contains non HSMFS data. Won't deallocate: ino=%lu (%u)",
00180             inode->i_ino, inode->i_generation);
00181         return -EFAULT;
00182     }
00183 
00184     kmem_cache_free(hsm_ii_cache_p, ivd_ii(inode));
00185     inode->i_private = NULL;
00186 
00187     return 0;
00188 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct inode * hsmfs_iget ( struct super_block *  sb,
unsigned long  ino 
) [read]

Definition at line 759 of file ivdfs_inode.c.

References DBG_II_DETAIL, DBG_VFS, ivd_dbg, ivd_ii, ivdfs_attach(), and ivdfs_iopen_get_inode().

Referenced by iopen_lookup(), ivdfs_data_state(), ivdfs_get_fileid(), ivdfs_get_fileinfo(), ivdfs_iopen_check(), ivdfs_lock_file(), ivdfs_set_fileid(), and ivdfs_trigger_event().

00759                                                                     {
00760     struct inode *inode;
00761 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00762     inode = iget(sb, ino);
00763     if (!inode) {
00764         return ERR_PTR(-ENOMEM);
00765     }
00766     else {
00767         return inode;
00768     }
00769 #else
00770     ivd_dbg(DBG_VFS, "ino=%lu", ino);
00771     inode = iget_locked(sb, ino);
00772     if (!inode) {
00773         return ERR_PTR(-ENOMEM);
00774     }
00775     if (!(inode->i_state & I_NEW)) {
00776         return inode;
00777     }
00778     else {
00779         ivd_comm_t *ic = ivd_ii(sb->s_root->d_inode)->ic;
00780         if (ivdfs_iopen_get_inode(inode, ic) != 0) {
00781             int setOpsRet = ivdfs_attach(ic, inode);
00782             if (setOpsRet != 0) {
00783                 ivd_dbg(DBG_VFS,
00784                         "Failed to hijack inode: %lu",
00785                         ino);
00786                 iget_failed(inode);
00787                 return ERR_PTR(setOpsRet);
00788             }
00789             else {
00790                 unlock_new_inode(inode);
00791                 return inode;
00792             }
00793         }
00794         else {
00795             ivd_dbg(DBG_II_DETAIL, "dev %u: ino=%lu New inode created in cache, no data available.",
00796                      sb->s_dev, ino);
00797             iget_failed(inode);
00798             return ERR_PTR(-ENOENT);
00799         }
00800     }
00801 #endif
00802 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivd_cleanup_comm ( ivd_comm_t ic  ) 

Definition at line 829 of file ivdfs_comm.c.

References IVD_FREE, ivd_initialize_comm(), ivd_req_entry_t::list, ivd_req_entry_t::req, ivd_comm_t::reqs_pending, and ivd_comm_t::reqs_waitreply.

Referenced by ivd_put_comm(), and ivdfs_dev_release().

00830 {
00831     struct list_head *lh, *tmp;
00832     ivd_req_entry_t *re;
00833 
00834     /* remove any pending/wait_reply requests from queues */
00835     list_for_each_safe(lh, tmp, &ic->reqs_pending) {
00836         re = list_entry(lh, ivd_req_entry_t, list);
00837         list_del(&re->list);
00838         IVD_FREE(re->req);
00839         IVD_FREE(re);
00840     }
00841 
00842     list_for_each_safe(lh, tmp, &ic->reqs_waitreply) {
00843         re = list_entry(lh, ivd_req_entry_t, list);
00844         list_del(&re->list);
00845         IVD_FREE(re->req);
00846         IVD_FREE(re);
00847     }
00848 
00849     /* cleanup comm structure for next user */
00850     ivd_initialize_comm(ic);
00851 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivd_comm_dump_state ( void   ) 

Definition at line 953 of file ivdfs_comm.c.

References ivd_req_entry_t::flags, ivd_req_t::hdr, ivd_info, MAX_IVDFS, ivd_req_entry_t::posttime, ivd_req_entry_t::req, ivd_req_hdr_t::reqid, ivd_req_entry_t::reqsize, and ivd_req_hdr_t::type.

Referenced by ivdfs_dev_ioctl().

00954 {
00955     int i, j;
00956     ivd_req_entry_t *re;
00957     struct list_head *lh;
00958 
00959     ivd_info("COMM STATE: jiffies=%lu", jiffies);
00960 
00961     for (i=0; i < MAX_IVDFS; i++) {
00962 
00963         if (ivd_comm[i].count == 0 && ivd_comm[i].pid == 0)
00964             continue;
00965 
00966         ivd_info("COMM STATE: <%d>  count=%u  dev=%s",
00967             i, ivd_comm[i].count,
00968             ivd_comm[i].dev != 0 ? ivd_comm[i].sb->s_id : "nofs");
00969 
00970         ivd_info("  pid=%d tgid=%d timeout=%lu req_seq_nr=%u sb=%p fs=%p messages=%lu sleeping=%lu apointment=%lu",
00971             ivd_comm[i].pid, ivd_comm[i].tgid, ivd_comm[i].timeout,
00972             ivd_comm[i].req_seq_nr, ivd_comm[i].sb, ivd_comm[i].fs,
00973             ivd_comm[i].message_counter, ivd_comm[i].sleep_counter,
00974             ivd_comm[i].last_apointment);
00975         ivd_info("  counters: N=%lu A=%lu M=%lu D=%lu O=%lu",
00976             ivd_comm[i].cnt_chg_name, ivd_comm[i].cnt_chg_attr,
00977             ivd_comm[i].cnt_chg_meta, ivd_comm[i].cnt_chg_data,
00978             ivd_comm[i].cnt_data_offl);
00979 
00980         spin_lock(&ivd_comm[i].lock);
00981         j = 0;
00982         list_for_each(lh, &ivd_comm[i].reqs_pending) {
00983             j++;
00984             re = list_entry(lh, ivd_req_entry_t, list);
00985 
00986             ivd_info("  PEND[%d]: [%u] type=%u, size=%d, flags=%04X, post=%lu",
00987                 j, re->req->hdr.reqid, re->req->hdr.type,
00988                 re->reqsize, re->flags,
00989                 re->posttime);
00990         }
00991         j = 0;
00992         list_for_each(lh, &ivd_comm[i].reqs_waitreply) {
00993             j++;
00994             re = list_entry(lh, ivd_req_entry_t, list);
00995 
00996             ivd_info("  WAIT[%d]: [%u] type=%u, size=%d, flags=%04X, post=%lu",
00997                 j, re->req->hdr.reqid, re->req->hdr.type,
00998                 re->reqsize, re->flags,
00999                 re->posttime);
01000         }
01001         spin_unlock(&ivd_comm[i].lock);
01002     }
01003 }

Here is the caller graph for this function:

ivd_comm_t * ivd_find_comm ( dev_t  dev  ) 

Definition at line 907 of file ivdfs_comm.c.

References MAX_IVDFS, and NULL.

Referenced by ivdfs_clear_inode(), ivdfs_dirty_inode(), ivdfs_kill_sb(), and ivdfs_put_super().

00908 {
00909     int i;
00910 
00911     /* Note: no spin_lock, because the one we search for cannot change */
00912 
00913     /* start with 1, because ivd_comm[0] is reserved for FSEvtMgr */
00914     for (i=1; i < MAX_IVDFS; i++) {
00915         if (ivd_comm[i].dev == dev && ivd_comm[i].sb)
00916             return &ivd_comm[i];
00917     }
00918     return NULL;
00919 }

Here is the caller graph for this function:

ivd_comm_t * ivd_get_comm ( dev_t  dev  ) 

Definition at line 854 of file ivdfs_comm.c.

References comm_lock, ivd_comm_t::count, DBG_COMM, ivd_comm_t::dev, HSM_OPMODE_REGULAR, hsmfs_timeout, ivd_alert, ivd_dbg, ivd_initialize_comm(), MAX_IVDFS, ivd_comm_t::minor, NULL, ivd_comm_t::opmode, ivd_comm_t::req_seq_nr, and ivd_comm_t::timeout.

Referenced by ivdfs_comm_init(), and ivdfs_get_sb().

00855 {
00856     unsigned int i;
00857 
00858     spin_lock(&comm_lock);
00859     for (i=0; i < MAX_IVDFS; i++) {
00860         if (!ivd_comm[i].count && ivd_comm[i].pid == 0) {
00861             char b[BDEVNAME_SIZE];
00862             ivd_dbg(DBG_COMM, "%s: allocated pseudo device <%u>",
00863                     dev == 0 ? "nofs" : __bdevname(dev, b), i);
00864             ivd_initialize_comm(&ivd_comm[i]);
00865             ivd_comm[i].count++;
00866             ivd_comm[i].dev = dev;
00867             ivd_comm[i].minor = i;
00868             ivd_comm[i].req_seq_nr = 0;
00869             ivd_comm[i].timeout = hsmfs_timeout * HZ;
00870             ivd_comm[i].opmode = HSM_OPMODE_REGULAR;
00871 
00872             break;
00873         }
00874     }
00875     spin_unlock(&comm_lock);
00876 
00877     if (i >= MAX_IVDFS) {
00878         char b[BDEVNAME_SIZE];
00879         ivd_alert("%s: [CRITICAL] ivd_comm table full (%d) - cannot add FS",
00880                 __bdevname(dev, b), MAX_IVDFS);
00881         return NULL;
00882     }
00883 
00884     return &ivd_comm[i];
00885 }

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_fs_t * ivd_get_fs ( char *  fstype  ) 

Definition at line 68 of file ivdfs_filter.c.

References ivd_fs_t::b_fst, ivd_fs_t::b_op, ivd_fs_t::count, DBG_FILTER, ivd_dbg, ivd_err, ivd_fs_t::name, NULL, ivd_fs_t::op, and supp_fs_lock.

Referenced by ivdfs_get_sb().

00069 {
00070     struct file_system_type *b_fst;
00071     int i;
00072 
00073     b_fst = get_fs_type(fstype);
00074     if (b_fst == NULL) {
00075         ivd_err("no kernel support for specified FS type: %s", fstype);
00076         return NULL;
00077     }
00078 
00079     spin_lock(&supp_fs_lock);
00080     for (i=0; ivd_supp_fs[i].name != NULL; i++) {
00081         if (strcmp(ivd_supp_fs[i].name, fstype) == 0) {
00082             break;
00083         }
00084     }
00085 
00086     if (ivd_supp_fs[i].name) {
00087         if (!ivd_supp_fs[i].count) { /* first time used */
00088             ivd_supp_fs[i].b_fst = b_fst;
00089 
00090             ivd_supp_fs[i].b_op =
00091                 (ivd_fs_b_ops_t*)kmalloc(sizeof(ivd_fs_b_ops_t), GFP_ATOMIC);
00092             if (!ivd_supp_fs[i].b_op) {
00093                 ivd_err("Cannot allocate memory!");
00094                 spin_unlock(&supp_fs_lock);
00095                 return NULL;
00096             }
00097             memset(ivd_supp_fs[i].b_op, 0, sizeof(ivd_fs_b_ops_t));
00098 
00099             ivd_supp_fs[i].op =
00100                 (ivd_fs_ops_t*)kmalloc(sizeof(ivd_fs_ops_t), GFP_ATOMIC);
00101             if (!ivd_supp_fs[i].op) {
00102                 ivd_err("Cannot allocate memory!");
00103                 spin_unlock(&supp_fs_lock);
00104                 return NULL;
00105             }
00106             memset(ivd_supp_fs[i].op, 0, sizeof(ivd_fs_ops_t));
00107         }
00108 
00109         ivd_supp_fs[i].count++;
00110 
00111         ivd_dbg(DBG_FILTER, "ivd_supp_fs[%s]=%u - GET (idx=%d)",
00112                 ivd_supp_fs[i].name, ivd_supp_fs[i].count, i);
00113     }
00114     else {
00115         ivd_err("specifed fs type %s not supported", fstype);
00116     }
00117     spin_unlock(&supp_fs_lock);
00118 
00119     if (ivd_supp_fs[i].name == NULL)
00120         return NULL;
00121 
00122     return &ivd_supp_fs[i];
00123 }

Here is the caller graph for this function:

void ivd_initialize_comm ( ivd_comm_t ic  ) 

Definition at line 798 of file ivdfs_comm.c.

References ivd_comm_t::cnt_chg_attr, ivd_comm_t::cnt_chg_data, ivd_comm_t::cnt_chg_meta, ivd_comm_t::cnt_chg_name, ivd_comm_t::cnt_data_offl, ivd_comm_t::dev, ivd_comm_t::evt_alert_time, ivd_nul_time, ivd_comm_t::last_apointment, ivd_comm_t::last_hsm_read, ivd_comm_t::last_warning_sent, ivd_comm_t::lock, ivd_comm_t::message_counter, ivd_comm_t::reqs_pending, ivd_comm_t::reqs_waitreply, ivd_comm_t::sem, ivd_comm_t::sleep_counter, ivd_comm_t::sleepq, and ivd_comm_t::waitq.

Referenced by ivd_cleanup_comm(), ivd_get_comm(), and ivdfs_comm_init().

00799 {
00800     memset(ic, 0, sizeof(ivd_comm_t));
00801 
00802     ic->dev = 0;
00803 
00804     init_rwsem(&ic->sem);
00805     spin_lock_init(&ic->lock);
00806 
00807     INIT_LIST_HEAD(&ic->reqs_pending);
00808     INIT_LIST_HEAD(&ic->reqs_waitreply);
00809 
00810     init_waitqueue_head(&ic->waitq);
00811 
00812     init_waitqueue_head(&ic->sleepq);
00813     ic->message_counter  = 0;
00814     ic->sleep_counter    = 0;
00815     ic->last_apointment  = 0;
00816     ic->last_warning_sent = 0;
00817     ic->last_hsm_read    = 0;
00818 
00819     ic->cnt_chg_name  = 0;
00820     ic->cnt_chg_attr  = 0;
00821     ic->cnt_chg_meta  = 0;
00822     ic->cnt_chg_data  = 0;
00823     ic->cnt_data_offl = 0;
00824 
00825     ic->evt_alert_time = ivd_nul_time;
00826 }

Here is the caller graph for this function:

void ivd_put_comm ( ivd_comm_t ic  ) 

Definition at line 888 of file ivdfs_comm.c.

References comm_lock, ivd_comm_t::count, DBG_COMM, ivd_comm_t::dev, ivd_comm_t::fs, ivd_cleanup_comm(), ivd_dbg, ivd_comm_t::minor, NULL, ivd_comm_t::pid, and ivd_comm_t::sb.

Referenced by ivdfs_comm_exit(), ivdfs_get_sb(), ivdfs_kill_sb(), and ivdfs_put_super().

00889 {
00890     spin_lock(&comm_lock);
00891     ivd_dbg(DBG_COMM, "%s: released pseudo device <%u>",
00892             ic->dev == 0 ? "nofs" : ic->sb->s_id, ic->minor);
00893 
00894     ic->count--;
00895     ic->sb = NULL;
00896     ic->fs = NULL;
00897 
00898     spin_unlock(&comm_lock);
00899 
00900     /* if there is also no listener -> cleanup queues */
00901     if (!ic->pid) {
00902         ivd_cleanup_comm(ic);
00903     }
00904 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivd_put_fs ( ivd_fs_t fs  ) 

Definition at line 126 of file ivdfs_filter.c.

References ivd_fs_t::b_fst, ivd_fs_t::b_op, ivd_fs_t::count, DBG_FILTER, ivd_dbg, ivd_fs_t::name, NULL, ivd_fs_t::op, and supp_fs_lock.

Referenced by ivdfs_get_sb(), ivdfs_kill_sb(), and ivdfs_put_super().

00127 {
00128 #if 0
00129     /* TODO: Do we need to take care in Linux 2.6? */
00130     /* dec bottom FS module use count */
00131 
00132     Use try_module_get and module_put?
00133 
00134     if (fs->b_fst->owner)
00135         __MOD_DEC_USE_COUNT(fs->b_fst->owner);
00136 #endif
00137     spin_lock(&supp_fs_lock);
00138     if (!--fs->count) {
00139         ivd_dbg(DBG_FILTER, "ivd_supp_fs[%s]=%u - PUT (LAST)",
00140                 fs->name, fs->count);
00141 
00142         fs->b_fst = NULL;
00143 
00144         kfree(fs->b_op);
00145         fs->b_op = NULL;
00146 
00147         kfree(fs->op);
00148         fs->op = NULL;
00149     }
00150     else {
00151         ivd_dbg(DBG_FILTER, "ivd_supp_fs[%s]=%u - PUT",
00152                 fs->name, fs->count);
00153     }
00154     spin_unlock(&supp_fs_lock);
00155 }

Here is the caller graph for this function:

int ivdfs_attach ( ivd_comm_t ic,
struct inode *  inode 
)

Definition at line 51 of file ivdfs_inode.c.

References DBG_VFS, ivd_dbg, ivdfs_read_inode_info(), ivdfs_set_inode_ops(), S_ISDIR, and S_ISREG.

Referenced by hsmfs_iget(), ivdfs_create(), ivdfs_dirty_inode(), ivdfs_lookup(), ivdfs_mkdir(), ivdfs_mknod(), and ivdfs_symlink().

00051                                                       {
00052     int ret = -ENOSYS;
00053     ivd_dbg(DBG_VFS, "ino=%lu (%u)", inode->i_ino, inode->i_generation);
00054 
00055     ret = ivdfs_set_inode_ops(ic, inode);
00056     if (ret == 0) {
00057         // read inode info from hsm attr
00058         // TODO: limited symlink and special files support (no inode info)
00059         if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) {
00060             // SMP: no i_sem for read inode
00061             ivdfs_read_inode_info(inode, 0);
00062         }
00063     }
00064     else {
00065 
00066         ivd_dbg(DBG_VFS, "ino=%lu (%u): Failed allocation of hsmfs inode info",
00067                 inode->i_ino, inode->i_generation);
00068     }
00069     ivd_dbg(DBG_VFS, "ino=%lu (%u) ret=%d", inode->i_ino, inode->i_generation, ret);
00070     return ret;
00071 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int ivdfs_bad_cookie ( ivd_inode_info_t ii  )  [inline, static]

Definition at line 356 of file ivdfs.h.

References ivd_inode_info_t::cookie, hsmfs_cookie, and NULL.

Referenced by alloc_hsmfs_inode_info(), free_hsmfs_inode_info(), ivdfs_get_fileinfo(), ivdfs_mark_clean(), ivdfs_mark_dirty(), ivdfs_mark_offline(), ivdfs_mark_online(), and ivdfs_set_fileid().

00356                                                          {
00357     if (ii == NULL || ii->cookie == NULL) {
00358         return 1;
00359     }
00360     return memcmp(ii->cookie, hsmfs_cookie, sizeof(ii->cookie)) != 0;
00361 }

Here is the caller graph for this function:

sector_t ivdfs_bmap ( struct address_space *  mapping,
sector_t  sect 
)

Definition at line 335 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_VFS_PAGE, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_addrs_ops().

00336 {
00337     sector_t ret = 0; // Zero means error state. Already checked in the ext3_bmap() function.
00338     struct inode* inode = mapping->host;
00339     ivd_comm_t *ic = ivd_ii(inode)->ic;
00340 
00341     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), blk=%llu",
00342             inode->i_ino, inode->i_generation, sect);
00343 
00344     if (ic->fs->b_op->f_addrs->bmap)
00345         ret = ic->fs->b_op->f_addrs->bmap(mapping, sect);
00346 
00347     return ret;
00348 
00349 }

Here is the caller graph for this function:

void ivdfs_clear_inode ( struct inode *  inode  ) 

This function is called when VFS wants to clear inode.

Cleanup of hsmfs inode info is done in this function.

Definition at line 194 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, free_hsmfs_inode_info(), ivd_comm_t::fs, ivd_dbg, ivd_err, ivd_find_comm(), ivd_ii, NULL, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00194                                             {
00195     ivd_comm_t *ic = NULL;
00196 
00197     ivd_dbg(DBG_VFS, "ino=%lu (%u)", inode->i_ino, inode->i_generation);
00198 
00199     if (ivd_ii(inode) == NULL) {
00200         ivd_dbg(DBG_VFS, "Inode has no hsm inode info: Trying to get it from i_sb->s_dev!");
00201         if (!(ic = ivd_find_comm(inode->i_sb->s_dev))) {
00202             ivd_err("Cannot find comm for device %u. Memory leak!", inode->i_sb->s_dev);
00203             return;
00204         }
00205     }
00206     else {
00207         ic = ivd_ii(inode)->ic;
00208     }
00209     if (!is_bad_inode(inode)) {
00210         free_hsmfs_inode_info(inode);
00211     }
00212     else {
00213         ivd_err("Bad inode -> hsmfs ii cannot be freed. ino=%lu (%u)", inode->i_ino, inode->i_generation);
00214     }
00215 
00216     if (ic->fs->b_op->super->clear_inode) {
00217         ic->fs->b_op->super->clear_inode(inode);
00218     }
00219 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_comm_add_req ( ivd_comm_t ic,
ivd_req_t req,
int  reqsize,
unsigned int  flags 
)

Definition at line 140 of file ivdfs_comm.c.

References ivd_comm_t::cnt_chg_attr, ivd_comm_t::cnt_chg_data, ivd_comm_t::cnt_chg_meta, ivd_comm_t::cnt_chg_name, ivd_comm_t::cnt_data_offl, DBG_COMM, DBG_COMM_DETAIL, DBG_EVT_DETAIL, ivd_comm_t::dev, ivd_comm_t::evt_alert_time, ivd_req_entry_t::flags, ivd_req_t::hdr, HSM_EVT_CHG_ATTR, HSM_EVT_CHG_DATA, HSM_EVT_CHG_META, HSM_EVT_CHG_NAME, HSM_EVT_DATA_OFFL, HSM_WRN_HSM_BUSY_d, hsmfs_event_alert, hsmfs_max_hsm_busy, hsmfs_max_outstanding, hsmfs_max_sleep_time, hsmfs_sleep_factor, ivd_alert, ivd_dbg, IVD_EF_NONBLOCK, IVD_EF_SYNC, ivd_err, IVD_MALLOC, ivdfs_comm_wait_reply(), ivdfs_evt_log_error(), ivd_comm_t::last_apointment, ivd_comm_t::last_hsm_read, ivd_comm_t::last_warning_sent, ivd_req_entry_t::list, ivd_comm_t::lock, ivd_comm_t::message_counter, ivd_comm_t::minor, NULL, ivd_comm_t::pid, ivd_req_entry_t::posttime, ivd_req_entry_t::req, ivd_comm_t::req_seq_nr, ivd_req_hdr_t::reqid, ivd_comm_t::reqs_pending, ivd_req_entry_t::reqsize, ivd_comm_t::sb, ivd_comm_t::sleep_counter, ivd_comm_t::sleepq, ivd_req_hdr_t::type, ivd_comm_t::waitq, and ivd_req_entry_t::waitq.

Referenced by ivdfs_evt_cancel_req(), ivdfs_evt_chg_attr(), ivdfs_evt_chg_data(), ivdfs_evt_chg_name(), ivdfs_evt_data_offl(), ivdfs_evt_log_error(), ivdfs_evt_mount(), ivdfs_evt_open(), ivdfs_evt_pre_mount(), ivdfs_evt_release(), and ivdfs_evt_umount().

00142 {
00143     ivd_req_entry_t *re;
00144     int ret = 0;
00145     long sleeptime = 0;
00146     unsigned long mess_counter, sleep_counter, current_jiffies;
00147 
00148     /* if ic is NULL, then send to FSEvtMgr (minor=0) */
00149     if (ic == NULL) {
00150         ic = &ivd_comm[0];
00151         if (!ic->pid) {
00152             ivd_alert("[CRITICAL] FSEVTMGR probably not running! "
00153                       "Cannot mount HSM file systems!");
00154             return -ENODEV;
00155         }
00156     }
00157 
00158     {
00159         spin_lock(&ic->lock);
00160         mess_counter = ic->message_counter;
00161         sleep_counter = ic->sleep_counter;
00162         // jiffies may owerflow after 497 days, but nothing should happen.
00163         // last_apointment is used only for messages
00164         current_jiffies = jiffies;
00165         if (mess_counter > hsmfs_max_outstanding) {
00166             unsigned long mess_factor = mess_counter - hsmfs_max_outstanding;
00167             if (mess_factor > (INT_MAX - 1) ) {
00168                 mess_factor = (INT_MAX - 1);  // to prevent overflow while calculating sleeptime
00169             }
00170             sleeptime = 1 + mess_factor * mess_factor / hsmfs_sleep_factor;
00171             if (sleeptime > hsmfs_max_sleep_time )  { // to prevent to much sleeping
00172                 ivd_dbg(DBG_EVT_DETAIL, "Reducing sleeptime from %lu to %d (hsmfs_max_sleep_time)",
00173                     sleeptime, hsmfs_max_sleep_time);
00174                 sleeptime = hsmfs_max_sleep_time;
00175             }
00176             ic->last_apointment = current_jiffies + sleeptime;
00177             ++(ic->sleep_counter);
00178             ivd_dbg(DBG_EVT_DETAIL, "sleeptime=%lu, apointment=%lu", sleeptime, ic->last_apointment);
00179         }
00180         spin_unlock(&ic->lock);
00181 
00182         if (sleeptime) {
00183             spin_lock(&ic->lock);
00184             if (ic->last_hsm_read > 0) {
00185                 unsigned long time_between_reads = (current_jiffies - ic->last_hsm_read) / HZ;
00186                 if (time_between_reads > hsmfs_max_hsm_busy) { //  time between reads
00187                     if (ic->last_warning_sent + HZ * 600 < jiffies) { // write message every 10 min
00188                         ic->last_warning_sent = jiffies;
00189                         ivd_alert("%s: [CRITICAL] HSM is busy. It's not reading FS events! "
00190                                 "Check HSM and or resources! not read for = %lu [sec], sleeptime = %lu messages=%lu sleeping to=%lu",
00191                                 ic->sb->s_id,
00192                                 time_between_reads,
00193                                 sleeptime,
00194                                 mess_counter,
00195                                 sleep_counter);
00196                         ivdfs_evt_log_error(HSM_WRN_HSM_BUSY_d, ic);
00197                     }
00198                 }
00199             }
00200             else {
00201                 ic->last_hsm_read = jiffies; // first event, set as HSM's last read was now
00202             }
00203             spin_unlock(&ic->lock);
00204             {
00205                 int ret = 0;
00206                 ivd_dbg(DBG_COMM_DETAIL, "sleep for sleeptime = %lu messages=%lu sleeping=%lu",
00207                         sleeptime, mess_counter, sleep_counter);
00208 
00209                 ret = wait_event_interruptible_timeout(ic->sleepq, 0, sleeptime);
00210 
00211                 if (ret != 0) {
00212                     ivd_dbg(DBG_COMM_DETAIL, "Interupted sleep ret = %d" , ret);
00213                 }
00214             }
00215         }
00216     }
00217 
00218     IVD_MALLOC(re, ivd_req_entry_t *, sizeof(ivd_req_entry_t));
00219 
00220     spin_lock(&ic->lock);
00221 
00222     if (sleeptime) {
00223         --(ic->sleep_counter);
00224     }
00225     ++(ic->message_counter);
00226     switch (req->hdr.type) {
00227         case HSM_EVT_CHG_NAME:  ic->cnt_chg_name++; break;
00228         case HSM_EVT_CHG_ATTR:  ic->cnt_chg_attr++; break;
00229         case HSM_EVT_CHG_META:  ic->cnt_chg_meta++; break;
00230         case HSM_EVT_CHG_DATA:  ic->cnt_chg_data++; break;
00231         case HSM_EVT_DATA_OFFL: ic->cnt_data_offl++; break;
00232     }
00233     if (ic->message_counter % hsmfs_event_alert == 0) {
00234         ivd_alert("%s: event queue size=%lu (N=%lu A=%lu M=%lu D=%lu O=%lu)",
00235             ic->dev == 0 ? "nofs" : ic->sb->s_id, ic->message_counter,
00236             ic->cnt_chg_name, ic->cnt_chg_attr, ic->cnt_chg_meta,
00237             ic->cnt_chg_data, ic->cnt_data_offl);
00238         ic->evt_alert_time = CURRENT_TIME;
00239     }
00240 
00241     mess_counter = ic->message_counter;
00242 
00243     req->hdr.reqid = ++ic->req_seq_nr;
00244     re->flags   = flags;
00245     re->req     = req;
00246     re->reqsize = reqsize;
00247     re->posttime = jiffies;
00248 
00249     ivd_dbg(DBG_COMM_DETAIL, "<%u> [%u] type=%u, size=%d, flags=%04X",
00250             ic->minor, req->hdr.reqid, req->hdr.type, reqsize, flags);
00251 
00252     init_waitqueue_head(&re->waitq);
00253 
00254     list_add(&re->list, ic->reqs_pending.prev);
00255 
00256     spin_unlock(&ic->lock);
00257 
00258     /* TODO: should we abort if no listener? what if userspace dies? */
00259     if (!ic->pid) {
00260         ivd_err("<%u> [%u] no listener -> put in queue",
00261                 ic->minor, req->hdr.reqid);
00262     }
00263 
00264     /* new request added - wake up readers */
00265     ivd_dbg(DBG_COMM_DETAIL, "new messages=%lu ", mess_counter);
00266     if (mess_counter == 1) { // wake reader if first message is on queue
00267         wake_up_interruptible(&ic->waitq);
00268     }
00269 
00270     if (re->flags & IVD_EF_NONBLOCK) {
00271         ivd_dbg(DBG_COMM, "<%u> [%u] non-blocking request added",
00272                 ic->minor, req->hdr.reqid);
00273     }
00274 
00275     if (re->flags & IVD_EF_SYNC) {
00276         int waitret = ivdfs_comm_wait_reply(ic, re);
00277 
00278         /* return reply code if different than success (!=0) */
00279         if (waitret != 0) {
00280             ret = waitret;
00281         }
00282     }
00283 
00284     return ret;
00285 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_comm_exit ( void   ) 

Definition at line 1054 of file ivdfs_comm.c.

References hsmfs_dev_major, and ivd_put_comm().

Referenced by ivdfs_exit().

01055 {
01056     /* release comm for primary pseudo device (minor=0) */
01057     ivd_put_comm(&ivd_comm[0]);
01058 
01059     unregister_chrdev(hsmfs_dev_major, "hsmfs_comm");
01060 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_comm_init ( void   ) 

Definition at line 1017 of file ivdfs_comm.c.

References hsmfs_dev_major, ivd_alert, ivd_err, ivd_get_comm(), ivd_initialize_comm(), ivdfs_dev_fops, and MAX_IVDFS.

Referenced by ivdfs_init().

01018 {
01019     int ret, i;
01020 
01021     /*
01022     NOTE: New communication interfaces have been added to linux kernel 2.6.
01023     Old infrastructure sill works (for now).
01024     */
01025     ret = register_chrdev(hsmfs_dev_major, "hsmfs_comm", &ivdfs_dev_fops);
01026     if (ret < 0) {
01027         ivd_err("[CRITICAL] cannot get major number %d for hsmfs_dev",
01028                 hsmfs_dev_major);
01029         return ret;
01030     }
01031 
01032     /* if major autoselected - save it */
01033     if (hsmfs_dev_major == 0)
01034         hsmfs_dev_major = ret;
01035 
01036     for(i=0; i < MAX_IVDFS; ++i) {
01037         ivd_initialize_comm(&ivd_comm[i]);
01038     }
01039 
01040     /*
01041      * Initialize structure for primary pseudo device (minor=0)
01042      * FS Event Manager is listening on this device.
01043      */
01044     if (!ivd_get_comm(0)) {
01045         ivd_alert("[CRITICAL] cannot get pseudo device %d:0!", hsmfs_dev_major);
01046         unregister_chrdev(hsmfs_dev_major, "hsmfs_comm");
01047         return -ENODEV;
01048     }
01049 
01050     return 0;
01051 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int ivdfs_comm_wait_reply ( ivd_comm_t ic,
ivd_req_entry_t re 
) [static]

Definition at line 57 of file ivdfs_comm.c.

References ivd_req_hdr_t::code, DBG_COMM, DBG_COMM_DETAIL, ivd_req_entry_t::flags, ivd_req_t::hdr, ivd_dbg, IVD_EF_REPLY, IVD_FREE, ivd_warn, ivdfs_evt_cancel_req(), ivd_comm_t::minor, ivd_req_entry_t::posttime, ivd_req_entry_t::req, ivd_req_hdr_t::reqid, ivd_comm_t::timeout, and ivd_req_entry_t::waitq.

Referenced by ivdfs_comm_add_req().

00058 {
00059     int ret = 0;
00060     DECLARE_WAITQUEUE(wait, current);
00061 
00062     ivd_dbg(DBG_COMM,
00063             "<%u> [%u] wait for reply (post=%lu, timeout=%lu)",
00064             ic->minor, re->req->hdr.reqid, re->posttime, ic->timeout);
00065 
00066     /* put process on wait queue and wait for reply */
00067     add_wait_queue(&re->waitq, &wait);
00068 
00069     while (!(re->flags & IVD_EF_REPLY)) {
00070 
00071         unsigned long cj = jiffies;
00072         int timeout_passed = 0;
00073 
00074         set_current_state(TASK_INTERRUPTIBLE);
00075 
00076         ivd_dbg(DBG_COMM_DETAIL,
00077                 "<%u> [%u] pid=%u sleeping (curr=%lu)...",
00078                 ic->minor, re->req->hdr.reqid, current->pid, jiffies);
00079 
00080         if (signal_pending(current)) {
00081             ivd_dbg(DBG_COMM,
00082                 "<%u> [%u] Pending signal. Stop waiting.",
00083                 ic->minor, re->req->hdr.reqid);
00084             break;
00085         }
00086 
00087         /* We are taking the overflow into account in the following condition:
00088            p+t can be less than p if the sum overflows.
00089 
00090            Timeout is false if cj hasn't overflown yet (cj > p),
00091            but p+t overflows (<p). (default value)
00092 
00093            In all other cases the condition is calculated in the same way:
00094               timeout = (p+t) > cj
00095         */
00096 
00097         if ((re->posttime + ic->timeout) > re->posttime || cj < re->posttime) {
00098             timeout_passed = (re->posttime + ic->timeout) < cj;
00099         }
00100 
00101         if (timeout_passed) {
00102             ivd_dbg(DBG_COMM,
00103                 "<%u> [%u] Timeout (post=%lu, timeout=%lu, cj=%lu)",
00104                 ic->minor, re->req->hdr.reqid, re->posttime, ic->timeout, cj);
00105             break;
00106         }
00107 
00108         schedule_timeout(ic->timeout - (cj - re->posttime) + 1);
00109     }
00110 
00111     /* back in business - we got reply, signal or timeout */
00112     set_current_state(TASK_RUNNING);
00113     remove_wait_queue(&re->waitq, &wait);
00114 
00115     if (re->flags & IVD_EF_REPLY) {
00116         /* return code from user space */
00117         ivd_dbg(DBG_COMM, "<%u> [%u] got reply - code=%d",
00118                 ic->minor, re->req->hdr.reqid, re->req->hdr.code);
00119         ret = re->req->hdr.code;
00120 
00121         IVD_FREE(re->req);
00122         IVD_FREE(re);
00123 
00124     }
00125     else if (signal_pending(current)) {
00126         ivd_warn("<%u> [%u] signaled when waiting for reply [%d:%d]",
00127                  ic->minor, re->req->hdr.reqid, current->pid, task_pgrp_nr(current));
00128         ret = -ERESTARTSYS;
00129     }
00130     else {
00131         ivd_warn("<%u> [%u] timeout waiting for reply (post=%lu, curr=%lu)",
00132                  ic->minor, re->req->hdr.reqid, re->posttime, jiffies);
00133         ivdfs_evt_cancel_req(ic, re->req->hdr.reqid);
00134         ret = -ERESTARTSYS;
00135     }
00136 
00137     return ret;
00138 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_commit_write ( struct file filp,
struct page *  page,
unsigned  from,
unsigned  to 
)

Definition at line 264 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_EVT_DETAIL, DBG_INV_IO, DBG_VFS_PAGE, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, ivd_dbg, ivd_ii, IVD_ISEM_HELD, ivdfs_evt_chg_data(), ivdfs_mark_dirty(), and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_addrs_ops().

00266 {
00267     int ret = -ENOSYS;
00268     struct inode* inode = filp->f_dentry->d_inode;
00269     ivd_comm_t *ic = ivd_ii(inode)->ic;
00270 
00271     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), pg=%lu [%u-%u]",
00272             inode->i_ino, inode->i_generation, page->index, from, to);
00273 
00274     if (ic->fs->b_op->f_addrs->commit_write)
00275         ret = ic->fs->b_op->f_addrs->commit_write(filp, page, from, to);
00276 
00277     /* if something was written -> send ChgData event */
00278     if (ret == 0) {
00279 
00280         if (task_pgrp_nr(current) == ic->tgid) {
00281             ivd_dbg(DBG_INV_IO,
00282                 "InvIO[%d,%d]: chg_data on commit_write(pg=%lu)",
00283                 current->pid, task_pgrp_nr(current), page->index);
00284         }
00285         else {
00286             loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + from;
00287 
00288             if (ivdfs_mark_dirty(inode, pos, ret, IVD_ISEM_HELD) > 0) {
00289                 (void) ivdfs_evt_chg_data(inode, pos, ret); /* TODO: err */
00290             }
00291             else {
00292                 ivd_dbg(DBG_EVT_DETAIL, "Data change, but no event and update");
00293             }
00294         }
00295     }
00296 
00297     return ret;
00298 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_create ( struct inode *  dir,
struct dentry *  dentry,
int  mode,
struct nameidata *  nd 
)

Definition at line 139 of file ivdfs_inode.c.

References ivd_fs_t::b_op, ivd_fs_b_ops_t::d_inode, DBG_INV_IO, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, IVD_IIF_CREATED, IVD_IIF_NEW_ENTRY, ivdfs_attach(), ivdfs_evt_chg_name(), NULL, and ivd_comm_t::tgid.

Referenced by ivdfs_set_d_inode_ops().

00141 {
00142     ivd_comm_t *ic = ivd_ii(dir)->ic;
00143     int ret = -ENOSYS;
00144 
00145     ivd_dbg(DBG_VFS, "dir=%lu (%u), name=%s, mode=%#o",
00146             dir->i_ino, dir->i_generation, dentry->d_iname, mode);
00147 
00148     if (ic->fs->b_op->d_inode->create) {
00149         ret = ic->fs->b_op->d_inode->create(dir, dentry, mode, nd);
00150     }
00151 
00152     if (ret == 0) {
00153         int setOpsRet = ivdfs_attach(ic, dentry->d_inode);
00154         if (setOpsRet != 0) {
00155             ivd_dbg(DBG_VFS,
00156                     "dir=%lu (%u), name=%s: Failed to hijack inode",
00157                     dir->i_ino, dir->i_generation, dentry->d_iname);
00158             return setOpsRet;
00159         }
00160         // Set flag to discriminate between created and existing new entries.
00161         ivd_ii(dentry->d_inode)->flags |= IVD_IIF_CREATED;
00162         ivd_ii(dentry->d_inode)->close_time = CURRENT_TIME;
00163         // No need to write EA until file_release.
00164         // Meanwhile inode is in use and will not be discarded.
00165 
00166         if (task_pgrp_nr(current) == ic->tgid) {
00167             ivd_dbg(DBG_INV_IO,
00168                 "InvIO[%d,%d]: create()",
00169                 current->pid, task_pgrp_nr(current));
00170         }
00171         else {
00172             ivd_ii(dentry->d_inode)->flags &= ~IVD_IIF_NEW_ENTRY;
00173             (void) ivdfs_evt_chg_name(dentry, NULL); /* TODO: error code */
00174         }
00175     }
00176 
00177     return ret;
00178 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_data_state ( ivd_comm_t ic,
unsigned int  cmd,
UInt64_t  id_fs,
UInt64_t  file_id,
UInt64_t  chunk_size,
UInt64_t  chunk_offset,
UInt32_t  mod_time 
)

Definition at line 987 of file ivdfs_hsmattr.c.

References DBG_II, DBG_II_DETAIL, EIVDBUSY, HSM_IOC_DATA_CLEAN, HSM_IOC_DATA_OFFLINE, HSM_IOC_DATA_ONLINE, hsmfs_iget(), ivd_dbg, ivd_err, IVD_FILE_GEN, IVD_FILE_INO, ivd_ii, ivd_warn, ivdfs_is_dirty, ivdfs_mark_clean(), ivdfs_mark_offline(), ivdfs_mark_online(), max, ivd_comm_t::minor, NULL, and ivd_comm_t::sb.

Referenced by ivdfs_dev_ioctl().

00994 {
00995     int ret = 0;
00996     struct inode *inode = NULL;
00997 
00998     ivd_dbg(
00999         DBG_II_DETAIL,
01000         "<%u> ino=%u (%u), cmd=%#x, id=%llu, ch_size=%llu, ch_off=%llu",
01001         ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs),
01002         cmd, file_id, chunk_size, chunk_offset
01003     );
01004 
01005     if (!ic->sb) {
01006         ivd_err("<%u> device not mounted - ino=%u (%u)",
01007                 ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
01008         return -ENODEV;
01009     }
01010 
01011     inode = hsmfs_iget(ic->sb, IVD_FILE_INO(id_fs));
01012     if (IS_ERR(inode)) {
01013         ivd_warn("<%u> inode not found - ino=%u (%u)",
01014                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
01015         return PTR_ERR(inode);
01016     }
01017 
01018     if (is_bad_inode(inode)) {
01019         ivd_dbg(DBG_II,"<%u> bad inode: ino=%u (%u)",
01020                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
01021         ret = -ENXIO;
01022         goto out;
01023     }
01024 
01025     if (inode->i_generation != IVD_FILE_GEN(id_fs)) {
01026         ivd_warn("<%u> invalid inode gen: ino=%u (%u) i_gen=%u",
01027                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs),
01028                  inode->i_generation);
01029         ret = -ENXIO;
01030         goto out;
01031     }
01032 
01033     //if (!file_id
01034     //    || ivd_ii(inode)->file_id != file_id) {
01035     //    ivd_warn("<%u> file ID mismatch, ino=%lu (%u), ii=%llu: got=%llu",
01036     //             ic->minor, inode->i_ino, inode->i_generation,
01037     //             ivd_ii(inode)->file_id, file_id);
01038     //    ret = -ENXIO;
01039     //    goto out;
01040     //}
01041 
01042     if (cmd == HSM_IOC_DATA_CLEAN) {
01043         ivd_dbg(DBG_II, "<%u> Mark ino=%lu (%u) CLEAN",
01044                 ic->minor, inode->i_ino, inode->i_generation);
01045         if(mod_time == max(inode->i_mtime.tv_sec, inode->i_ctime.tv_sec)) {
01046             // TODO: check locking for SMP
01047             ivdfs_mark_clean(inode, chunk_size, chunk_offset, 0);
01048         }
01049         else {
01050             ivd_warn("<%u> Mark ino=%lu (%u) CLEAN failed - file has changed "
01051                      "(mt_got=%u, mt_cur=%lu)!",
01052                      ic->minor, inode->i_ino, inode->i_generation,
01053                      mod_time, inode->i_mtime.tv_sec);
01054             ret = -EIVDBUSY;
01055             goto out;
01056         }
01057     }
01058     else if (cmd == HSM_IOC_DATA_OFFLINE) {
01059         ivd_dbg(DBG_II, "<%u> Mark ino=%lu (%u) OFFLINE",
01060                 ic->minor, inode->i_ino, inode->i_generation);
01061         if(ivd_ii(inode)->o_count != 0) { // TODO: check locking for SMP
01062             ivd_warn("<%u> Mark ino=%lu (%u) OFFLINE failed - file is opened "
01063                      "(open_count=%u)!",
01064                      ic->minor, inode->i_ino, inode->i_generation,
01065                      ivd_ii(inode)->o_count);
01066             ret = -EIVDBUSY;
01067             goto out;
01068         }
01069         else if (ivdfs_is_dirty(inode, 0, 0)) {
01070             ivd_warn("<%u> Mark ino=%lu (%u) OFFLINE failed - file is dirty!",
01071                         ic->minor, inode->i_ino, inode->i_generation);
01072             ret = -EIVDBUSY;
01073             goto out;
01074         }
01075         else if (0 == inode->i_size) {
01076             ivd_warn("<%u> Mark ino=%lu (%u) OFFLINE failed - file is empty!",
01077                         ic->minor, inode->i_ino, inode->i_generation);
01078             ret = -EPERM;
01079             goto out;
01080         }
01081         else {
01082             if (ivdfs_mark_offline(inode, chunk_size,
01083                 chunk_offset, 0) < 0) {
01084                 ret = -EIVDBUSY;
01085                 ivd_dbg(DBG_II, "ivdfs_data_state: <%u> Mark ino=%lu (%u) OFFLINE failed- returning %d",
01086                         ic->minor, inode->i_ino, inode->i_generation, ret);
01087                 goto out;
01088             }
01089         }
01090     }
01091     else if (cmd == HSM_IOC_DATA_ONLINE) {
01092         ivd_dbg(DBG_II, "<%u> Mark ino=%lu (%u) ONLINE",
01093                 ic->minor, inode->i_ino, inode->i_generation);
01094 
01095         ivdfs_mark_online(inode, chunk_size, chunk_offset, 0);
01096     }
01097     else {
01098         ivd_err("<%u> Data State ino=%lu (%u) - invalid cmd=%#x",
01099                 ic->minor, inode->i_ino, inode->i_generation, cmd);
01100     }
01101 
01102     ret = 0;
01103 
01104 out:
01105     iput(inode);
01106     return ret;
01107 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_delete_inode ( struct inode *  inode  ) 

Definition at line 331 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00332 {
00333     ivd_comm_t *ic = ivd_ii(inode)->ic;
00334 
00335     ivd_dbg(DBG_VFS, "ino=%lu (%u)", inode->i_ino, inode->i_generation);
00336 
00337     if (ic->fs->b_op->super->delete_inode)
00338         ic->fs->b_op->super->delete_inode(inode);
00339 }

Here is the caller graph for this function:

static int ivdfs_dev_ioctl ( struct inode *  inode,
struct file file,
unsigned int  cmd,
unsigned long  arg 
) [static]

Definition at line 499 of file ivdfs_comm.c.

References ivd_ioc_lockfile_t::chg_time, ivd_ioc_triggevent_t::chunk_offset, ivd_ioc_datastate_t::chunk_offset, ivd_ioc_triggevent_t::chunk_size, ivd_ioc_datastate_t::chunk_size, ivd_ioc_lockfile_t::chunk_size, ivd_ioc_setfileid_t::chunk_size, DBG_COMM_DETAIL, DBG_MAIN, ivd_ioc_triggevent_t::evt, ivd_ioc_datastate_t::file_id, ivd_ioc_lockfile_t::file_id, ivd_ioc_setfileid_t::file_id, ivd_ioc_lockfile_t::flags, HSM_IOC_DATA_CLEAN, HSM_IOC_DATA_OFFLINE, HSM_IOC_DATA_ONLINE, HSM_IOC_DUMP_STATE, HSM_IOC_GET_FILE_INFO, HSM_IOC_GET_FILEID, HSM_IOC_LOCK_FILE, HSM_IOC_MOD_COUNT, HSM_IOC_SET_DEBUG, HSM_IOC_SET_FILEID, HSM_IOC_SET_INVIO_PID, HSM_IOC_SET_OPMODE, HSM_IOC_SET_TIMEOUT, HSM_IOC_TRIGGER_EVENT, HSM_IOC_UNLOCK_FILE, hsmfs_debug, ivd_ioc_triggevent_t::id_fs, ivd_ioc_datastate_t::id_fs, ivd_ioc_fileinfo_t::id_fs, ivd_ioc_lockfile_t::id_fs, ivd_ioc_setfileid_t::id_fs, ivd_comm_dump_state(), ivd_dbg, IVD_FILE_INO, ivd_info, ivd_warn, ivdfs_data_state(), ivdfs_get_fileid(), ivdfs_get_fileinfo(), ivdfs_lock_file(), ivdfs_set_fileid(), ivdfs_setopmode(), ivdfs_trigger_event(), ivd_comm_t::minor, ivd_ioc_datastate_t::mod_time, ivd_ioc_lockfile_t::op, ivd_ioc_opmode_t::operation_mode, ivd_comm_t::sem, ivd_comm_t::tgid, ivd_comm_t::timeout, and ivd_ioc_opmode_t::WORM_timeout.

00501 {
00502     ivd_comm_t *ic = (ivd_comm_t *)file->private_data;
00503     int ret = 0;
00504 
00505     ivd_dbg(DBG_COMM_DETAIL, "<%u> cmd=0x%X", ic->minor, cmd);
00506 
00507     down_read(&ic->sem);
00508 
00509     switch(cmd) {
00510     case HSM_IOC_MOD_COUNT: {
00511         int count = (int)arg;
00512 
00513         ivd_dbg(DBG_MAIN, "<%u> change module usage count: %d",
00514                 ic->minor, count);
00515 #if 0
00516         /* TODO: What's the purpose of this? Do we need to take care in Linux 2.6? */
00517         /* There is no module use count available any more */
00518         while (count > 0) {
00519             MOD_INC_USE_COUNT;
00520             count--;
00521         }
00522         while (count < 0) {
00523         /* TODO: What's the purpose of this? Do we need to take care in Linux 2.6? */
00524             MOD_DEC_USE_COUNT;
00525             count++;
00526         }
00527 #endif
00528         goto out;
00529     }
00530 
00531     case HSM_IOC_SET_DEBUG: {
00532         unsigned int debug = arg;
00533         ivd_dbg(DBG_MAIN, "<%u> change debug level: 0x%08X",
00534                 ic->minor, debug);
00535 
00536         ivd_dbg(DBG_MAIN, " old value = 0x%08lX", hsmfs_debug);
00537         hsmfs_debug = debug;
00538         goto out;
00539     }
00540 
00541     case HSM_IOC_SET_TIMEOUT: {
00542         unsigned short timeout = (unsigned short)arg;
00543 
00544         ivd_dbg(DBG_COMM_DETAIL, "<%u> change event timeout: %hu sec",
00545                 ic->minor, timeout);
00546 
00547         if (timeout == 0) {
00548             ivd_dbg(DBG_COMM_DETAIL, "  invalid value (should be > 0)");
00549         }
00550         else {
00551             ivd_dbg(DBG_COMM_DETAIL, "  old value = %lu jiffies", ic->timeout);
00552             ic->timeout = timeout * HZ;
00553             ivd_dbg(DBG_COMM_DETAIL, "  new value = %lu jiffies", ic->timeout);
00554         }
00555 
00556         goto out;
00557     }
00558 
00559     case HSM_IOC_DUMP_STATE: {
00560         ivd_dbg(DBG_MAIN, "<%u> dump state", ic->minor);
00561 
00562         ivd_comm_dump_state();
00563 
00564         goto out;
00565     }
00566 
00567     case HSM_IOC_SET_OPMODE: {
00568         ivd_ioc_opmode_t in;
00569 
00570         if (copy_from_user(&in, (char *)arg, sizeof(in))) {
00571             ret = -EFAULT;
00572             goto out;
00573         }
00574 
00575         ret = ivdfs_setopmode(ic, in.operation_mode, in.WORM_timeout);
00576 
00577         goto out;
00578     }
00579 
00580     case HSM_IOC_SET_FILEID: {
00581         ivd_ioc_setfileid_t in;
00582 
00583         if (copy_from_user(&in, (char *)arg, sizeof(in))) {
00584             ret = -EFAULT;
00585             goto out;
00586         }
00587 
00588         ivd_dbg(DBG_COMM_DETAIL, "<%u> set file ID: ino=%u, fid=%llu",
00589             ic->minor, IVD_FILE_INO(in.id_fs), in.file_id);
00590 
00591         ret = ivdfs_set_fileid(ic, in.id_fs, in.file_id, in.chunk_size);
00592 
00593         goto out;
00594     }
00595 
00596     case HSM_IOC_GET_FILEID: {
00597         ivd_ioc_setfileid_t in;
00598 
00599         if (copy_from_user(&in, (char *)arg, sizeof(in))) {
00600             ret = -EFAULT;
00601             goto out;
00602         }
00603 
00604         ret = ivdfs_get_fileid(ic, in.id_fs, &in.file_id, &in.chunk_size);
00605         if (ret)
00606             goto out;
00607 
00608         if (copy_to_user((char *)arg, &in, sizeof(in))) {
00609             ret = -EFAULT;
00610         }
00611 
00612         goto out;
00613     }
00614 
00615     case HSM_IOC_LOCK_FILE:
00616     case HSM_IOC_UNLOCK_FILE: {
00617         ivd_ioc_lockfile_t in;
00618 
00619         if (copy_from_user(&in, (char *)arg, sizeof(in))) {
00620             ret = -EFAULT;
00621             goto out;
00622         }
00623 
00624         ret = ivdfs_lock_file(ic, cmd,
00625                               in.id_fs, in.file_id, in.op,
00626                               &in.chg_time, &in.chunk_size, &in.flags);
00627         if (ret)
00628             goto out;
00629 
00630         if (copy_to_user((char *)arg, &in, sizeof(in))) {
00631             ret = -EFAULT;
00632         }
00633 
00634         goto out;
00635     }
00636 
00637     case HSM_IOC_GET_FILE_INFO: {
00638         ivd_ioc_fileinfo_t in;
00639 
00640         if (copy_from_user(&in, (char *)arg, sizeof(in))) {
00641             ret = -EFAULT;
00642             goto out;
00643         }
00644 
00645         ivd_dbg(DBG_COMM_DETAIL, "<%u> get file info: ino=%u",
00646                 ic->minor, IVD_FILE_INO(in.id_fs));
00647 
00648         ret = ivdfs_get_fileinfo(ic, IVD_FILE_INO(in.id_fs), &in);
00649         if (ret)
00650             goto out;
00651 
00652         if (copy_to_user((char *)arg, &in, sizeof(in))) {
00653             ret = -EFAULT;
00654         }
00655 
00656         goto out;
00657     }
00658 
00659     case HSM_IOC_DATA_CLEAN:
00660     case HSM_IOC_DATA_ONLINE:
00661     case HSM_IOC_DATA_OFFLINE: {
00662         ivd_ioc_datastate_t in;
00663 
00664         memset(&in, 0, sizeof(in));
00665         if (copy_from_user(&in, (char *)arg, sizeof(in))) {
00666             ret = -EFAULT;
00667             goto out;
00668         }
00669 
00670         ret = ivdfs_data_state(ic, cmd,
00671                                in.id_fs, in.file_id,
00672                                in.chunk_size, in.chunk_offset,
00673                                in.mod_time);
00674 
00675         goto out;
00676     }
00677 
00678     case HSM_IOC_TRIGGER_EVENT: {
00679         ivd_ioc_triggevent_t in;
00680 
00681         memset(&in, 0, sizeof(in));
00682         if (copy_from_user(&in, (char *)arg, sizeof(in))) {
00683             ret = -EFAULT;
00684             goto out;
00685         }
00686 
00687         ivd_dbg(DBG_COMM_DETAIL, "<%u> trig event %u ch_size=%llu, ch_off=%llu",
00688                 ic->minor, in.evt, in.chunk_size, in.chunk_offset);
00689         ret = ivdfs_trigger_event(ic, in.evt, in.id_fs,
00690                                   in.chunk_size, in.chunk_offset);
00691 
00692         goto out;
00693     }
00694 
00695     case HSM_IOC_SET_INVIO_PID: {
00696         int invio_pid = (int)arg;
00697 
00698         ivd_info( "<%u> change invio old pid : %d, new pid : %d",
00699                 ic->minor, ic->tgid, invio_pid);
00700 
00701         ic->tgid = invio_pid;
00702         goto out;
00703     }
00704 
00705     default:
00706         ivd_warn("<%u> invalid ioctl() - cmd=0x%X", ic->minor, cmd);
00707         ret = -EINVAL;
00708         goto out;
00709     }
00710 
00711 out:
00712     up_read(&ic->sem);
00713     return ret;
00714 }

Here is the call graph for this function:

static int ivdfs_dev_open ( struct inode *  inode,
struct file file 
) [static]

Definition at line 717 of file ivdfs_comm.c.

References DBG_COMM_DETAIL, ivd_comm_t::dev, EIVDBUSY, hsmfs_dev_major, ivd_alert, ivd_dbg, ivd_info, MAX_IVDFS, ivd_comm_t::minor, minor, ivd_comm_t::pid, ivd_comm_t::sem, and ivd_comm_t::tgid.

00718 {
00719     int ret = 0;
00720     int minor = MINOR(inode->i_rdev);
00721     ivd_comm_t *ic = &ivd_comm[minor];
00722 
00723     ivd_dbg(DBG_COMM_DETAIL, "<%u>", minor);
00724 
00725     if (minor >= MAX_IVDFS) {
00726         ivd_alert("pseudo device minor number (%d) too big", minor);
00727         return -ENODEV;
00728     }
00729 
00730     down_write(&ic->sem);
00731 
00732     /* allow only one userspace reader/writer */
00733     if (ic->pid) {
00734         ret = -EIVDBUSY;
00735         ivd_dbg(DBG_COMM_DETAIL, "ivdfs_dev_open:allow only one userspace reader/writer RC= %d", ret );
00736         goto out;
00737     }
00738 
00739     ic->minor = minor;
00740     ic->pid = current->pid;
00741     ic->tgid = task_pgrp_nr(current);
00742 
00743     /* store pointer to ivd_comm_t structure in file structure */
00744     file->private_data = ic;
00745 
00746     {
00747         char b[BDEVNAME_SIZE];
00748         ivd_info("%s: device %u:%u opened by [%d:%d]",
00749             ic->dev == 0 ? "nofs" : __bdevname(ic->dev, b),
00750             hsmfs_dev_major, minor, ic->pid, ic->tgid);
00751     }
00752 out:
00753     up_write(&ic->sem);
00754 
00755     return ret;
00756 }

static unsigned int ivdfs_dev_poll ( struct file file,
struct poll_table_struct *  wait 
) [static]

Definition at line 478 of file ivdfs_comm.c.

References DBG_COMM_DETAIL, ivd_dbg, ivd_comm_t::lock, ivd_comm_t::minor, ivd_comm_t::reqs_pending, and ivd_comm_t::waitq.

00479 {
00480 
00481     ivd_comm_t *ic = (ivd_comm_t *)file->private_data;
00482     unsigned int mask = POLLOUT | POLLWRNORM; /* can write anytime */
00483 
00484     ivd_dbg(DBG_COMM_DETAIL, "<%u>", ic->minor);
00485 
00486     poll_wait(file, &(ic->waitq), wait);
00487 
00488     spin_lock(&ic->lock);
00489     if (!list_empty(&ic->reqs_pending)) {
00490         ivd_dbg(DBG_COMM_DETAIL, "<%u> requests pending!", ic->minor);
00491         mask |= POLLIN | POLLRDNORM;
00492     }
00493     spin_unlock(&ic->lock);
00494 
00495     return mask;
00496 }

static ssize_t ivdfs_dev_read ( struct file file,
char __user *  buf,
size_t  nbytes,
loff_t *  off 
) [static]

Definition at line 287 of file ivdfs_comm.c.

References ivd_comm_t::cnt_chg_attr, ivd_comm_t::cnt_chg_data, ivd_comm_t::cnt_chg_meta, ivd_comm_t::cnt_chg_name, ivd_comm_t::cnt_data_offl, DBG_COMM, DBG_COMM_DETAIL, ivd_comm_t::dev, ivd_comm_t::evt_alert_time, HSM_EVT_CHG_ATTR, HSM_EVT_CHG_DATA, HSM_EVT_CHG_META, HSM_EVT_CHG_NAME, HSM_EVT_DATA_OFFL, ivd_alert, ivd_dbg, IVD_EF_NONBLOCK, IVD_EF_SYNC, IVD_FREE, ivd_nul_time, ivd_warn, ivd_comm_t::last_apointment, ivd_comm_t::last_hsm_read, ivd_comm_t::lock, ivd_comm_t::message_counter, ivd_comm_t::minor, NULL, ivd_comm_t::reqs_pending, ivd_comm_t::reqs_waitreply, ivd_comm_t::sb, size, ivd_comm_t::sleep_counter, ivd_comm_t::sleepq, and ivd_comm_t::waitq.

00288 {
00289     ssize_t size, ret = 0;
00290     unsigned int reqid = 0;
00291     unsigned int flags = 0;
00292     ivd_comm_t *ic = (ivd_comm_t *)file->private_data;
00293     ivd_req_entry_t *re = NULL;
00294     DECLARE_WAITQUEUE(wait, current);
00295 
00296     ivd_dbg(DBG_COMM_DETAIL, "<%u> nbytes=%u", ic->minor, nbytes);
00297 
00298     /* if nothing to read - return */
00299     if (nbytes == 0)
00300         goto out;
00301 
00302     spin_lock(&ic->lock);
00303     ivd_dbg(DBG_COMM_DETAIL, "messages=%lu sleeping=%lu apointment=%lu",
00304         ic->message_counter, ic->sleep_counter, ic->last_apointment);
00305 
00306     if (ic->message_counter == 0)  {
00307         spin_unlock(&ic->lock);
00308         /* put process on wait queue in case there is nothing to send */
00309         add_wait_queue(&ic->waitq, &wait);
00310         set_current_state(TASK_INTERRUPTIBLE);
00311 
00312         spin_lock(&ic->lock);
00313 
00314         while (list_empty(&ic->reqs_pending)) {
00315             ivd_dbg(DBG_COMM_DETAIL, "empty message que. interupt sleepq.");
00316             ic->last_hsm_read = 0; // no more events
00317             wake_up_interruptible(&ic->sleepq);
00318             if (signal_pending(current)) {
00319                 ret = -ERESTARTSYS;
00320                 break;
00321             }
00322             /*
00323             TODO: Is this necessary at all? Linux 2.6 is preemptive kernel...
00324             */
00325             spin_unlock(&ic->lock);
00326             schedule();
00327             spin_lock(&ic->lock);
00328         }
00329 
00330         /* back in business - we got a pending request or signal */
00331         set_current_state(TASK_RUNNING);
00332         remove_wait_queue(&ic->waitq, &wait);
00333 
00334         /* signal received - return */
00335         if (ret) {
00336             spin_unlock(&ic->lock);
00337             goto out;
00338         }
00339     }
00340     /* take next request from list of pending requests */
00341     re = list_entry(ic->reqs_pending.next, ivd_req_entry_t, list);
00342     list_del(&re->list);
00343 
00344     ivd_dbg(DBG_COMM_DETAIL, "Reading event type: %u", re->req->hdr.type);
00345 
00346     flags = re->flags;
00347     --(ic->message_counter);
00348     switch (re->req->hdr.type) {
00349         case HSM_EVT_CHG_NAME:  ic->cnt_chg_name--; break;
00350         case HSM_EVT_CHG_ATTR:  ic->cnt_chg_attr--; break;
00351         case HSM_EVT_CHG_META:  ic->cnt_chg_meta--; break;
00352         case HSM_EVT_CHG_DATA:  ic->cnt_chg_data--; break;
00353         case HSM_EVT_DATA_OFFL: ic->cnt_data_offl--; break;
00354     }
00355     /* if queue is empty and alert was sent, alert again */
00356     if ( ic->message_counter == 0 && !timespec_equal(&(ic->evt_alert_time), &(ivd_nul_time)) ) {
00357         ivd_alert("%s: event queue empty",
00358                   ic->dev == 0 ? "nofs" : ic->sb->s_id);
00359         ic->evt_alert_time = ivd_nul_time;
00360     }
00361 
00362     ic->last_hsm_read = jiffies;
00363 
00364     spin_unlock(&ic->lock);
00365 
00366     /* userspace should have buffer big enough to receive complete request */
00367     size = re->reqsize;
00368     if (nbytes < size) {
00369         ivd_warn("<%u> buffer too small (%u, but %u required)",
00370                  ic->minor, nbytes, size);
00371         size = nbytes;
00372     }
00373     reqid = re->req->hdr.reqid;
00374 
00375     if (copy_to_user(buf, re->req, size)) {
00376         ret = -EFAULT;
00377         goto out;
00378     }
00379 
00380     if (re->flags & IVD_EF_SYNC) {
00381         spin_lock(&ic->lock);
00382         list_add(&re->list, ic->reqs_waitreply.prev);
00383         spin_unlock(&ic->lock);
00384         re = NULL; /* do not remove request entry */
00385     }
00386 
00387     ret = size;
00388 
00389 out:
00390     ivd_dbg(DBG_COMM_DETAIL, "<%u> [%u] sent=%d", ic->minor, reqid, ret);
00391 
00392     /* free request entry if set */
00393     if (re != NULL) {
00394         IVD_FREE(re->req);
00395         IVD_FREE(re);
00396     }
00397 
00398     if (flags & IVD_EF_NONBLOCK) {
00399         ivd_dbg(DBG_COMM, "<%u> [%u] non-blocking request removed",
00400                 ic->minor, reqid);
00401     }
00402 
00403     return ret;
00404 }

static int ivdfs_dev_release ( struct inode *  inode,
struct file file 
) [static]

Definition at line 759 of file ivdfs_comm.c.

References DBG_COMM_DETAIL, ivd_comm_t::dev, HSM_ERR_HSM_CLOSED_d, hsmfs_dev_major, ivd_alert, ivd_cleanup_comm(), ivd_dbg, ivd_info, ivdfs_evt_log_error(), ivd_comm_t::message_counter, ivd_comm_t::minor, ivd_comm_t::pid, ivd_comm_t::sb, ivd_comm_t::sem, ivd_comm_t::sleep_counter, and ivd_comm_t::tgid.

00760 {
00761     int ret = 0;
00762     ivd_comm_t *ic = (ivd_comm_t *)file->private_data;
00763 
00764     ivd_dbg(DBG_COMM_DETAIL, "<%u>", ic->minor);
00765 
00766     down_write(&ic->sem);
00767 
00768     /* TODO: what to do with pending requests on release? */
00769     ic->pid = 0;
00770     ic->tgid = 0;
00771 
00772     ivd_info("%s: device %u:%u closed by [%d:%d]",
00773              ic->dev == 0 ? "nofs" : ic->sb->s_id,
00774              hsmfs_dev_major, MINOR(inode->i_rdev),
00775              current->pid, task_pgrp_nr(current));
00776 
00777     // check if FS still mounted -> HSM has probably died
00778     if (ic->minor > 0 && ic->sb) {
00779         ivd_alert("%s: [CRITICAL] HSM not listening for FS events! "
00780                   "Unmount FS and check logs for more details! # messages in que=%lu, # of sleeping users=%lu.",
00781                   ic->sb->s_id,
00782                   ic->message_counter,
00783                   ic->sleep_counter);
00784         ivdfs_evt_log_error(HSM_ERR_HSM_CLOSED_d, ic);
00785     }
00786 
00787     up_write(&ic->sem);
00788 
00789     /* if FS not mounted anymore -> cleanup queues */
00790     if (!ic->sb) {
00791         ivd_cleanup_comm(ic);
00792     }
00793 
00794     return ret;
00795 }

Here is the call graph for this function:

static ssize_t ivdfs_dev_write ( struct file file,
const char __user *  buf,
size_t  nbytes,
loff_t *  off 
) [static]

Definition at line 407 of file ivdfs_comm.c.

References DBG_COMM_DETAIL, ivd_dbg, IVD_EF_REPLY, ivd_err, IVD_FREE, ivd_comm_t::lock, ivd_comm_t::minor, NULL, and ivd_comm_t::reqs_waitreply.

00408 {
00409     ssize_t ret = 0;
00410     ivd_comm_t *ic = (ivd_comm_t *)file->private_data;
00411     ivd_req_entry_t *re = NULL;
00412     ivd_req_entry_t *tmp;
00413     struct list_head *lh;
00414     ivd_req_hdr_t hdr;
00415 
00416     ivd_dbg(DBG_COMM_DETAIL, "<%u> nbytes=%u", ic->minor, nbytes);
00417 
00418     /* check if write includes at least req hdr */
00419     if (nbytes < sizeof(hdr)) {
00420         ivd_err("<%u> buffer too small (%u, but %u required)",
00421                 ic->minor, nbytes, sizeof(hdr));
00422         return -EINVAL;
00423     }
00424 
00425     if (copy_from_user(&hdr, buf, sizeof(hdr))) {
00426         memset(&hdr, 0, sizeof(hdr));
00427         ret = -EFAULT;
00428         goto out;
00429     }
00430 
00431     spin_lock(&ic->lock);
00432     list_for_each(lh, &ic->reqs_waitreply) {
00433         tmp = list_entry(lh, ivd_req_entry_t, list);
00434         if (tmp->req->hdr.reqid == hdr.reqid) {
00435             re = tmp;
00436             break;
00437         }
00438     }
00439 
00440     if (!re) {
00441         spin_unlock(&ic->lock);
00442 
00443         ivd_err("<%u> [%u] got reply on wrong request!", ic->minor, hdr.reqid);
00444         ret = -EBADRQC;
00445         goto out;
00446     }
00447 
00448     /* copy response header into request */
00449     memcpy(re->req, &hdr, sizeof(hdr));
00450 
00451     re->flags |= IVD_EF_REPLY;
00452 
00453     /* remove it from wait list */
00454     list_del(&re->list);
00455     spin_unlock(&ic->lock);
00456 
00457     if (waitqueue_active(&re->waitq)) {
00458         wake_up_interruptible(&re->waitq);
00459     }
00460     else
00461     {
00462         /* nobody is waiting -> remove it */
00463         IVD_FREE(re->req);
00464         IVD_FREE(re);
00465     }
00466 
00467     /* confirm that everything is read */
00468     ret = nbytes;
00469 
00470 out:
00471     ivd_dbg(DBG_COMM_DETAIL, "<%u> [%u] got=%d", ic->minor, hdr.reqid, ret);
00472 
00473     return ret;
00474 
00475 }

ssize_t ivdfs_direct_IO ( int  rw,
struct kiocb *  kiocb,
const struct iovec *  iov,
loff_t  offset,
unsigned long  nr_segs 
)

Definition at line 381 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_VFS_PAGE, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_addrs_ops().

00384 {
00385     ssize_t ret = -ENOSYS;
00386     struct inode* inode = kiocb->ki_filp->f_dentry->d_inode;
00387     ivd_comm_t *ic = ivd_ii(inode)->ic;
00388 
00389     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u)",
00390             inode->i_ino, inode->i_generation);
00391 
00392     if (ic->fs->b_op->f_addrs->direct_IO)
00393         ret = ic->fs->b_op->f_addrs->direct_IO(rw, kiocb, iov, offset, nr_segs);
00394 
00395     return ret;
00396 }

Here is the caller graph for this function:

void ivdfs_dirty_inode ( struct inode *  inode  ) 

Definition at line 248 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_err, ivd_find_comm(), ivd_ii, ivdfs_attach(), NULL, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00249 {
00250     ivd_comm_t *ic = NULL;
00251 
00252     ivd_dbg(DBG_VFS, "ino=%lu (%u)", inode->i_ino, inode->i_generation);
00253 
00254     if (ivd_ii(inode) == NULL) {
00255         ivd_dbg(DBG_VFS, "Inode has no hsm inode info: Trying to get it from i_sb->s_dev!");
00256         if (!(ic = ivd_find_comm(inode->i_sb->s_dev))) {
00257             ivd_err("Cannot find comm for device %u. Memory leak!", inode->i_sb->s_dev);
00258             return;
00259         }
00260         else {
00261             int setOpsRet = ivdfs_attach(ic, inode);
00262             if (setOpsRet != 0) {
00263                 ivd_err("ino=%lu (%u): Failed to hijack inode",
00264                         inode->i_ino, inode->i_generation);
00265                 return;
00266             }
00267         }
00268     }
00269     else {
00270         ic = ivd_ii(inode)->ic;
00271     }
00272 
00273     ivd_dbg(DBG_VFS, "ino=%lu (%u)", inode->i_ino, inode->i_generation);
00274 
00275     if (ic->fs->b_op->super->dirty_inode)
00276         ic->fs->b_op->super->dirty_inode(inode);
00277 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_drop_inode ( struct inode *  inode  ) 

This function is called when the last access to the inode is dropped, with the inode_lock spinlock held.

New in 2.6.

Definition at line 346 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_FILTER, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00347 {
00348     ivd_comm_t *ic = ivd_ii(inode)->ic;
00349 
00350     ivd_dbg(DBG_FILTER, "ino=%lu (%u)", inode->i_ino, inode->i_generation);
00351 
00352     if (ic->fs->b_op->super->drop_inode) {
00353         ic->fs->b_op->super->drop_inode(inode);
00354     }
00355 }

Here is the caller graph for this function:

int ivdfs_evt_cancel_req ( ivd_comm_t ic,
int  reqid 
)

Definition at line 152 of file ivdfs_events.c.

References ivd_req_t::cancel, DBG_EVT, HSM_EVT_CANCEL_REQ, ivd_dbg, IVD_EVT_HDR, IVD_MALLOC, ivdfs_comm_add_req(), ivd_comm_t::minor, ivd_req_cancel_req_t::reqid, and ivd_comm_t::sb.

Referenced by ivdfs_comm_wait_reply().

00153 {
00154     ivd_req_t *req;
00155     int reqsize;
00156 
00157     ivd_dbg(DBG_EVT, "<%u> reqid=%d", ic->minor, reqid);
00158 
00159     reqsize = sizeof(ivd_req_cancel_req_t);
00160     IVD_MALLOC(req, ivd_req_t *, reqsize);
00161 
00162     IVD_EVT_HDR(req, HSM_EVT_CANCEL_REQ, ic->sb ? ic->sb->s_dev : 0);
00163     req->cancel.reqid = reqid;
00164 
00165     /* Must be non blocking or we'll fall in recursion. */
00166     return ivdfs_comm_add_req(ic, req, reqsize, 0);
00167 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_evt_chg_attr ( struct dentry *  de  ) 

Definition at line 404 of file ivdfs_events.c.

References ivd_req_t::chg_attr, ivd_req_chg_attr_t::chg_time, DBG_EVT, DBG_EVT_DETAIL, ivd_req_chg_attr_t::file_id, ivd_req_chg_attr_t::file_mode, HSM_EVT_CHG_ATTR, hsmfs_path_bufsize, ivd_dbg, IVD_EVT_HDR, IVD_FREE, ivd_ii, IVD_MALLOC, ivdfs_comm_add_req(), ivdfs_get_path(), len, ivd_req_chg_attr_t::path, and path.

Referenced by ivdfs_setattr(), and ivdfs_trigger_event().

00405 {
00406     ivd_req_t *req;
00407     int reqsize, len;
00408     char *path;
00409     struct inode *inode = de->d_inode;
00410 
00411     ivd_dbg(DBG_EVT, "<%u> ino=%lu (%u)",
00412             ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00413 
00414     // fix bug 533
00415     // HSM brakes if it receives events for deleted files
00416     if (inode->i_nlink == 0) {
00417         ivd_dbg(DBG_EVT, "nlink==0, event ignored");
00418         return 0;
00419     }
00420     // end fix
00421 
00422     IVD_MALLOC(path, char *, hsmfs_path_bufsize);
00423 
00424     len = ivdfs_get_path(de, path, hsmfs_path_bufsize);
00425 
00426     if (len == -ENAMETOOLONG) {
00427         IVD_FREE(path);
00428         return -ENAMETOOLONG;
00429     }
00430 
00431     reqsize = sizeof(ivd_req_chg_attr_t)
00432               - sizeof(ivd_path_t)
00433               + len;
00434 
00435     IVD_MALLOC(req, ivd_req_t *, reqsize);
00436 
00437     IVD_EVT_HDR(req, HSM_EVT_CHG_ATTR, inode->i_sb->s_dev);
00438     req->chg_attr.file_id          = ivd_ii(inode)->file_id;
00439     req->chg_attr.chg_time         = ivd_ii(inode)->chg_time.tv_sec;
00440     req->chg_attr.file_mode        = inode->i_mode;
00441     memcpy(&req->chg_attr.path, path, len);
00442 
00443     IVD_FREE(path);
00444 
00445     ivd_dbg(DBG_EVT_DETAIL,
00446             "<%u> id=%llu, chg_time=%u, file_mode=%#o",
00447             ivd_ii(inode)->ic->minor, req->chg_attr.file_id,
00448             req->chg_attr.chg_time, req->chg_attr.file_mode);
00449 
00450     return ivdfs_comm_add_req(ivd_ii(inode)->ic, req, reqsize, 0);
00451 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_evt_chg_data ( struct inode *  inode,
loff_t  off,
size_t  size 
)

Definition at line 337 of file ivdfs_events.c.

References ivd_req_t::chg_data, ivd_req_chg_data_t::chg_time, ivd_req_chg_data_t::chunk_offset, ivd_req_chg_data_t::chunk_size, DBG_EVT, DBG_EVT_DETAIL, ivd_req_chg_data_t::file_id, HSM_EVT_CHG_DATA, HSM_VIRTUAL_INODE_DIR, hsmfs_path_bufsize, ivd_req_chg_data_t::id_fs, ivd_dbg, IVD_EVT_HDR, IVD_FILE_ID_FS, IVD_FREE, ivd_ii, IVD_MALLOC, ivd_warn, ivdfs_comm_add_req(), ivdfs_get_path(), len, ivd_req_chg_data_t::path, and path.

Referenced by ivdfs_commit_write(), ivdfs_evt_simulate_create(), ivdfs_file_aio_write(), ivdfs_file_release(), ivdfs_file_write(), ivdfs_trigger_event(), and ivdfs_truncate().

00338 {
00339     ivd_req_t *req;
00340     int reqsize, len;
00341     char *path;
00342 
00343     ivd_dbg(DBG_EVT, "<%u> ino=%lu (%u)",
00344             ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00345 
00346     // fix bug 533
00347     // HSM brakes if it receives events for deleted files
00348     if (inode->i_nlink == 0) {
00349         ivd_dbg(DBG_EVT, "nlink==0, event ignored");
00350         return 0;
00351     }
00352     // end fix
00353 
00354     if (inode->i_ino == HSM_VIRTUAL_INODE_DIR) {
00355         ivd_dbg(DBG_EVT, "HSM_VIRTUAL_INODE_DIR so event ignored");
00356         return 0;
00357     }
00358 
00359     if (list_empty(&inode->i_dentry)) {
00360         ivd_warn("<%u> ino=%lu (%u) has empty dentry list, event ignored",
00361             ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00362         // TBD: Should we send an event to HSM anyway?
00363         // It could then retry to get the path (at next mount).
00364         return 0;
00365     }
00366 
00367     IVD_MALLOC(path, char *, hsmfs_path_bufsize);
00368 
00369     // use first directory entry as pathname
00370     len = ivdfs_get_path(
00371             list_entry(inode->i_dentry.next, struct dentry, d_alias),
00372             path, hsmfs_path_bufsize);
00373 
00374     if (len == -ENAMETOOLONG) {
00375         IVD_FREE(path);
00376         return -ENAMETOOLONG;
00377     }
00378 
00379     reqsize = sizeof(ivd_req_chg_data_t)-sizeof(ivd_path_t) + len;
00380     IVD_MALLOC(req, ivd_req_t *, reqsize);
00381 
00382     IVD_EVT_HDR(req, HSM_EVT_CHG_DATA, inode->i_sb->s_dev);
00383     req->chg_data.file_id      = ivd_ii(inode)->file_id;
00384     req->chg_data.id_fs        = IVD_FILE_ID_FS(inode->i_ino,
00385                                                 inode->i_generation);
00386     req->chg_data.chg_time     = ivd_ii(inode)->chg_time.tv_sec;
00387     req->chg_data.chunk_size   = ivd_ii(inode)->chunk_size;
00388     req->chg_data.chunk_offset = 0;
00389 
00390     memcpy(&req->chg_data.path, path, len);
00391 
00392     IVD_FREE(path);
00393 
00394     ivd_dbg(DBG_EVT_DETAIL,
00395             "<%u> id=%llu, chg_time=%u, ch_size=%llu, ch_off=%llu",
00396             ivd_ii(inode)->ic->minor,
00397             req->chg_data.file_id,req->chg_data.chg_time,
00398             req->chg_data.chunk_size, req->chg_data.chunk_offset);
00399 
00400     return ivdfs_comm_add_req(ivd_ii(inode)->ic, req, reqsize, 0);
00401 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_evt_chg_name ( struct dentry *  de,
struct dentry *  de_old 
)

Definition at line 262 of file ivdfs_events.c.

References ivd_req_t::chg_name, ivd_req_chg_name_t::chg_time, DBG_EVT, DBG_EVT_DETAIL, ivd_req_chg_name_t::file_id, ivd_file_t::file_id, ivd_req_chg_name_t::file_mode, HSM_EVT_CHG_NAME, hsmfs_path_bufsize, ivd_file_t::id_fs, ivd_dbg, IVD_EVT_HDR, IVD_FREE, ivd_ii, IVD_IIF_NEW_ENTRY, IVD_MALLOC, ivdfs_comm_add_req(), ivdfs_get_path(), len, NULL, ivd_req_chg_name_t::path, path, and ivd_req_chg_name_t::path_old_offset.

Referenced by ivdfs_create(), ivdfs_evt_simulate_create(), ivdfs_link(), ivdfs_mkdir(), ivdfs_rename(), ivdfs_rmdir(), and ivdfs_unlink().

00263 {
00264     ivd_req_t *req;
00265     int reqsize, len, len_old;
00266     char *path, *path_old;
00267     struct inode *inode = (de && de->d_inode) ?  de->d_inode : de_old->d_inode;
00268     struct inode *old_inode = (de_old) ? de_old->d_inode : NULL;
00269     ivd_file_t *f;
00270 
00271     ivd_dbg(DBG_EVT, "<%u> ino=%lu (%u)",
00272             ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00273 
00274     /* allocate one buffer to hold both path and path_old */
00275     IVD_MALLOC(path, char *, 2 * hsmfs_path_bufsize);
00276     path_old = path + hsmfs_path_bufsize;
00277 
00278     len = ivdfs_get_path(de, path, hsmfs_path_bufsize);
00279 
00280     if (len == -ENAMETOOLONG) {
00281         IVD_FREE(path);
00282         return -ENAMETOOLONG;
00283     }
00284 
00285     if (de && de_old && de->d_inode) { // Move over existing file
00286         if ( !(ivd_ii(de_old->d_inode)->flags & IVD_IIF_NEW_ENTRY) ) {  // EAs set
00287             ivd_dbg(DBG_EVT_DETAIL,
00288                 "<%u> Move over existing file. Delete event added. ino=%lu (%u)",
00289                 ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00290             ivdfs_evt_chg_name(NULL, de); // Add delete event if new name exists.
00291             f = (ivd_file_t *)(path + sizeof(ivd_path_t) - sizeof(ivd_file_t));
00292             f->file_id = 0;
00293             f->id_fs = 0;
00294         }
00295         // else no EAs (for file to be overwritten) up to now -> ignore delete event
00296     }
00297 
00298     len_old = ivdfs_get_path(de_old, path_old, hsmfs_path_bufsize);
00299 
00300     if (len_old == -ENAMETOOLONG) {
00301         IVD_FREE(path);
00302         return -ENAMETOOLONG;
00303     }
00304 
00305     reqsize = sizeof(ivd_req_chg_name_t)
00306               - sizeof(ivd_path_t)
00307               + len + len_old;
00308 
00309     IVD_MALLOC(req, ivd_req_t *, reqsize);
00310 
00311     IVD_EVT_HDR(req, HSM_EVT_CHG_NAME, inode->i_sb->s_dev);
00312     if (de && old_inode) { // if move over
00313         req->chg_name.file_id          = ivd_ii(old_inode)->file_id;
00314         req->chg_name.chg_time         = ivd_ii(old_inode)->chg_time.tv_sec;
00315         req->chg_name.file_mode        = old_inode->i_mode;
00316     }
00317     else {
00318         req->chg_name.file_id          = ivd_ii(inode)->file_id;
00319         req->chg_name.chg_time         = ivd_ii(inode)->chg_time.tv_sec;
00320         req->chg_name.file_mode        = inode->i_mode;
00321     }
00322     req->chg_name.path_old_offset  = reqsize - len_old;
00323     memcpy(&req->chg_name.path, path, len);
00324     memcpy((char *)req + req->chg_name.path_old_offset, path_old, len_old);
00325 
00326     IVD_FREE(path);
00327 
00328     ivd_dbg(DBG_EVT_DETAIL,
00329             "<%u> id=%llu, chg_time=%u, file_mode=%#o",
00330             ivd_ii(inode)->ic->minor, req->chg_name.file_id,
00331             req->chg_name.chg_time, req->chg_name.file_mode);
00332 
00333     return ivdfs_comm_add_req(ivd_ii(inode)->ic, req, reqsize, 0);
00334 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_evt_data_offl ( struct dentry *  de,
loff_t  off,
size_t  size,
int  cause 
)

Definition at line 454 of file ivdfs_events.c.

References ivd_req_data_offl_t::cause, ivd_req_data_offl_t::chunk_offset, ivd_req_data_offl_t::chunk_size, ivd_req_t::data_offl, DBG_EVT, DBG_EVT_DETAIL, DBG_MAIN, ivd_req_data_offl_t::file_id, ivd_file_t::file_id, HSM_CAUSE_OFFLINE, HSM_EVT_DATA_OFFL, hsmfs_path_bufsize, ivd_req_data_offl_t::id_fs, ivd_file_t::id_fs, ivd_dbg, IVD_EF_SYNC, IVD_EVT_HDR, IVD_FILE_ID_FS, IVD_FREE, ivd_ii, IVD_MALLOC, ivdfs_comm_add_req(), ivdfs_get_path(), ivd_file_t::len, len, ivd_path_t::levels, ivd_file_t::name, ivd_req_data_offl_t::path, ivd_path_t::path, and path.

Referenced by ivdfs_file_aio_read(), ivdfs_file_aio_write(), ivdfs_file_read(), ivdfs_file_write(), ivdfs_prepare_write(), ivdfs_readpage(), ivdfs_readpages(), ivdfs_setattr(), and ivdfs_trigger_event().

00455 {
00456     ivd_req_t *req;
00457     int reqsize, len;
00458     char *path;
00459     struct inode *inode;
00460     int flags = 0;
00461 
00462     ivd_dbg(DBG_EVT_DETAIL, "&dentry %p", de);
00463 
00464     inode = de->d_inode;
00465     ivd_dbg(DBG_EVT_DETAIL, "&inode %p, d_flags %u ", inode, de->d_flags );
00466 
00467     ivd_dbg(DBG_EVT_DETAIL, "&inode->ic %p, ", ivd_ii(inode)->ic );
00468 
00469     ivd_dbg(DBG_EVT, "<%u> ino=%lu (%u), cause=%d",
00470             ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation, cause);
00471 
00472     IVD_MALLOC(path, char *, hsmfs_path_bufsize);
00473 
00474     // use first directory entry as pathname
00475     len = ivdfs_get_path(
00476             list_entry(inode->i_dentry.next, struct dentry, d_alias),
00477             path, hsmfs_path_bufsize);
00478 #if 0
00479     // fake the recall with empty name (KADASTER) problem
00480     {
00481         ivd_path_t *p = (ivd_path_t *)path;
00482         ivd_dbg(DBG_MAIN, "Faking the recall with empty name problem. ino=%lu (%u) FileId=%llu",
00483                 inode->i_ino, inode->i_generation, ivd_ii(inode)->file_id);
00484         p->levels = 1;
00485         p->path[0].id_fs = IVD_FILE_ID_FS(inode->i_ino,inode->i_generation);
00486         p->path[0].file_id =  ivd_ii(inode)->file_id;
00487         p->path[0].len = 1;
00488         p->path[0].name[0] = 0;
00489     }
00490 #endif
00491     if (len == -ENAMETOOLONG) {
00492         IVD_FREE(path);
00493         return -ENAMETOOLONG;
00494     }
00495 
00496     reqsize = sizeof(ivd_req_data_offl_t)-sizeof(ivd_path_t) + len;
00497 //    reqsize = sizeof(ivd_req_data_offl_t);
00498     IVD_MALLOC(req, ivd_req_t *, reqsize);
00499 
00500     IVD_EVT_HDR(req, HSM_EVT_DATA_OFFL, inode->i_sb->s_dev);
00501     req->data_offl.file_id     = ivd_ii(inode)->file_id;
00502     req->data_offl.id_fs       = IVD_FILE_ID_FS(inode->i_ino,
00503                                                 inode->i_generation);
00504     req->data_offl.chunk_size  = size; // part and size
00505     req->data_offl.chunk_offset= off;  // of the file to recall
00506     req->data_offl.cause       = cause;
00507 
00508     memcpy(&req->data_offl.path, path, len);
00509 
00510     IVD_FREE(path);
00511 
00512     ivd_dbg(DBG_EVT_DETAIL,
00513             "<%u> id=%llu, ch_size=%llu, ch_off=%llu",
00514             ivd_ii(inode)->ic->minor, req->data_offl.file_id,
00515             req->data_offl.chunk_size, req->data_offl.chunk_offset);
00516 
00517     // Only user caused data offline events are syncronous.
00518     if (cause == HSM_CAUSE_OFFLINE) {
00519         flags = IVD_EF_SYNC;
00520     }
00521 
00522     return ivdfs_comm_add_req(ivd_ii(inode)->ic, req, reqsize, flags);
00523 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_evt_log_error ( int  code,
ivd_comm_t ic 
)

Definition at line 525 of file ivdfs_events.c.

References ivd_req_log_error_t::code, DBG_EVT, ivd_req_t::error, HSM_EVT_LOG_ERROR, ivd_dbg, IVD_EVT_HDR, IVD_MALLOC, ivdfs_comm_add_req(), NULL, and ivd_comm_t::sb.

Referenced by ivdfs_comm_add_req(), and ivdfs_dev_release().

00526 {
00527     ivd_req_t *req;
00528     int reqsize;
00529 
00530     ivd_dbg(DBG_EVT, "<0> code=%d", code);
00531 
00532     reqsize = sizeof(ivd_req_log_error_t);
00533     IVD_MALLOC(req, ivd_req_t *, reqsize);
00534 
00535     IVD_EVT_HDR(req, HSM_EVT_LOG_ERROR, ic->sb ? ic->sb->s_dev : 0);
00536     req->error.code = code;
00537 
00538     return ivdfs_comm_add_req(NULL, req, reqsize, 0);
00539 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_evt_mount ( ivd_comm_t ic,
dev_t  fs_device,
const char *  dev_name,
int  code 
)

Definition at line 169 of file ivdfs_events.c.

References ivd_req_hdr_t::code, DBG_EVT, ivd_req_t::hdr, HSM_EVT_MOUNT, ivd_dbg, IVD_EVT_HDR, IVD_MALLOC, ivdfs_comm_add_req(), and ivd_comm_t::minor.

Referenced by ivdfs_get_sb().

00170 {
00171     ivd_req_t *req;
00172     int reqsize;
00173 
00174     ivd_dbg(DBG_EVT, "<%u> dev=%s", ic->minor, dev_name);
00175 
00176     reqsize = sizeof(ivd_req_mount_t);
00177     IVD_MALLOC(req, ivd_req_t *, reqsize);
00178 
00179     IVD_EVT_HDR(req, HSM_EVT_MOUNT, fs_device);
00180     req->hdr.code = code;
00181 
00182     return ivdfs_comm_add_req(ic, req, reqsize, 0);
00183 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_evt_open ( struct file file  ) 

Definition at line 201 of file ivdfs_events.c.

References DBG_EVT, HSM_EVT_OPEN, hsmfs_path_bufsize, ivd_dbg, IVD_EVT_HDR, IVD_FREE, ivd_ii, IVD_MALLOC, ivdfs_comm_add_req(), ivdfs_get_path(), len, ivd_req_t::open, ivd_req_open_t::path, and path.

Referenced by ivdfs_file_open().

00202 {
00203     ivd_req_t *req;
00204     int reqsize, len;
00205     char *path;
00206     struct inode* inode = file->f_dentry->d_inode;
00207 
00208     ivd_dbg(DBG_EVT, "<%u> ino=%lu (%u)",
00209             ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00210 
00211     IVD_MALLOC(path, char *, hsmfs_path_bufsize);
00212 
00213     len = ivdfs_get_path(file->f_dentry, path, hsmfs_path_bufsize);
00214 
00215     if (len == -ENAMETOOLONG) {
00216         IVD_FREE(path);
00217         return -ENAMETOOLONG;
00218     }
00219 
00220     reqsize = sizeof(ivd_req_open_t)-sizeof(ivd_path_t) + len;
00221     IVD_MALLOC(req, ivd_req_t *, reqsize);
00222 
00223     IVD_EVT_HDR(req, HSM_EVT_OPEN, inode->i_sb->s_dev);
00224     memcpy(&req->open.path, path, len);
00225 
00226     IVD_FREE(path);
00227 
00228     return ivdfs_comm_add_req(ivd_ii(inode)->ic, req, reqsize, 0);
00229 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_evt_pre_mount ( ivd_comm_t ic,
dev_t  dev,
unsigned short  comm_minor,
const char *  dev_name 
)

Definition at line 131 of file ivdfs_events.c.

References ivd_req_pre_mount_t::comm_minor, DBG_EVT, DBG_EVT_DETAIL, ivd_req_pre_mount_t::dev_name, HSM_EVT_PRE_MOUNT, ivd_dbg, IVD_EF_SYNC, IVD_EVT_HDR, IVD_MALLOC, ivdfs_comm_add_req(), ivd_comm_t::minor, and ivd_req_t::pre_mount.

Referenced by ivdfs_get_sb().

00132 {
00133     ivd_req_t *req;
00134     int reqsize;
00135 
00136     char b[BDEVNAME_SIZE];
00137     ivd_dbg(DBG_EVT, "<%u> dev=%s", ic ? ic->minor : 0, __bdevname(dev, b));
00138 
00139     reqsize = sizeof(ivd_req_pre_mount_t);
00140     IVD_MALLOC(req, ivd_req_t *, reqsize);
00141 
00142     IVD_EVT_HDR(req, HSM_EVT_PRE_MOUNT, dev);
00143     req->pre_mount.comm_minor = comm_minor;
00144     strcpy(req->pre_mount.dev_name, dev_name);
00145 
00146     ivd_dbg(DBG_EVT_DETAIL,
00147             "<%u> comm_minor=%u dev_name=%s", ic ? ic->minor : 0, comm_minor, dev_name);
00148 
00149     return ivdfs_comm_add_req(ic, req, reqsize, IVD_EF_SYNC);
00150 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_evt_release ( struct file file  ) 

Definition at line 231 of file ivdfs_events.c.

References DBG_EVT, HSM_EVT_RELEASE, hsmfs_path_bufsize, ivd_dbg, IVD_EVT_HDR, IVD_FREE, ivd_ii, IVD_MALLOC, ivdfs_comm_add_req(), ivdfs_get_path(), len, ivd_req_release_t::path, path, and ivd_req_t::release.

00232 {
00233     ivd_req_t *req;
00234     int reqsize, len;
00235     char *path;
00236     struct inode* inode = file->f_dentry->d_inode;
00237 
00238     ivd_dbg(DBG_EVT, "<%u> ino=%lu (%u)",
00239             ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00240 
00241     IVD_MALLOC(path, char *, hsmfs_path_bufsize);
00242 
00243     len = ivdfs_get_path(file->f_dentry, path, hsmfs_path_bufsize);
00244 
00245     if (len == -ENAMETOOLONG) {
00246         IVD_FREE(path);
00247         return -ENAMETOOLONG;
00248     }
00249 
00250     reqsize = sizeof(ivd_req_release_t)-sizeof(ivd_path_t) + len;
00251     IVD_MALLOC(req, ivd_req_t *, reqsize);
00252 
00253     IVD_EVT_HDR(req, HSM_EVT_RELEASE, inode->i_sb->s_dev);
00254     memcpy(&req->release.path, path, len);
00255 
00256     IVD_FREE(path);
00257 
00258     return ivdfs_comm_add_req(ivd_ii(inode)->ic, req, reqsize, 0);
00259 }

Here is the call graph for this function:

void ivdfs_evt_simulate_create ( struct dentry *  de  ) 

Definition at line 541 of file ivdfs_events.c.

References DBG_EVT_DETAIL, ivd_dbg, ivd_ii, IVD_IIF_NEW_ENTRY, ivdfs_evt_chg_data(), ivdfs_evt_chg_name(), ivdfs_is_dirty, and NULL.

Referenced by ivdfs_file_open(), ivdfs_lookup(), and ivdfs_trigger_event().

00542 {
00543 
00544     ivd_dbg(DBG_EVT_DETAIL,
00545         "ino=%lu (%u) new entry, size=%llu, -> notify HSM",
00546         de->d_inode->i_ino, de->d_inode->i_generation, de->d_inode->i_size);
00547 
00548     ivd_ii(de->d_inode)->flags &= ~IVD_IIF_NEW_ENTRY;
00549 
00550     // new entry -> send chg_name
00551     (void) ivdfs_evt_chg_name(de, NULL);
00552 
00553     // regular file -> send chg_data (mark it dirty)
00554     if (de->d_inode->i_size
00555         && ivdfs_is_dirty(de->d_inode, 0, 0)) {
00556 
00557         ivd_ii(de->d_inode)->chg_time = CURRENT_TIME;
00558         ivd_dbg(DBG_EVT_DETAIL, "Set chg_time=%lu ", ivd_ii(de->d_inode)->chg_time.tv_sec);
00559         (void) ivdfs_evt_chg_data(de->d_inode,
00560             0, de->d_inode->i_size);
00561     }
00562 
00563 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_evt_umount ( ivd_comm_t ic,
struct super_block *  sb 
)

Definition at line 185 of file ivdfs_events.c.

References DBG_EVT, HSM_EVT_UMOUNT, ivd_dbg, IVD_EF_NONBLOCK, IVD_EVT_HDR, IVD_MALLOC, ivdfs_comm_add_req(), and ivd_comm_t::minor.

Referenced by ivdfs_put_super().

00186 {
00187     ivd_req_t *req;
00188     int reqsize;
00189 
00190     ivd_dbg(DBG_EVT, "<%u> dev=%s", ic->minor, sb->s_id);
00191 
00192     reqsize = sizeof(ivd_req_umount_t);
00193     IVD_MALLOC(req, ivd_req_t *, reqsize);
00194 
00195     IVD_EVT_HDR(req, HSM_EVT_UMOUNT, sb->s_dev);
00196 
00197     /* note: we send umount event non-blocking to prevent umount hang */
00198     return ivdfs_comm_add_req(ic, req, reqsize, IVD_EF_NONBLOCK);
00199 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void __exit ivdfs_exit ( void   )  [static]

Definition at line 458 of file ivdfs_mod.c.

References ivd_info, ivdfs_comm_exit(), and ivdfs_slab_destroy().

00459 {
00460     ivdfs_comm_exit();
00461 
00462     unregister_filesystem(&hsmfs_fstype);
00463 
00464     ivdfs_slab_destroy();
00465 
00466     ivd_info("bye, bye!");
00467 }

Here is the call graph for this function:

int ivdfs_file_aio_fsync ( struct kiocb *  kiocb,
int  datasync 
)

Definition at line 498 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_file_ops().

00499 {
00500     int ret = -ENOSYS;
00501     struct inode* inode = kiocb->ki_filp->f_dentry->d_inode;
00502     ivd_comm_t *ic = ivd_ii(inode)->ic;
00503 
00504     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u)",
00505             current->pid, task_pgrp_nr(current),
00506             inode->i_ino, inode->i_generation);
00507 
00508     if (ic->fs->b_op->f_file->aio_fsync)
00509         ret = ic->fs->b_op->f_file->aio_fsync(kiocb, datasync);
00510 
00511     ivd_dbg(DBG_VFS, "ret=%d", ret);
00512 
00513     return ret;
00514 }

Here is the caller graph for this function:

ssize_t ivdfs_file_aio_read ( struct kiocb *  kiocb,
const struct iovec *  iovec,
unsigned long  size,
loff_t  offset 
)

Definition at line 273 of file ivdfs_file.c.

References DBG_INV_IO, DBG_VFS, EIVDBUSY, HSM_CAUSE_OFFLINE, if(), ivd_dbg, ivd_ii, ivdfs_evt_data_offl(), ivdfs_is_offline, and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_file_ops().

00275 {
00276     ssize_t ret = -ENOSYS;
00277     struct inode* inode = kiocb->ki_filp->f_dentry->d_inode;
00278     ivd_comm_t *ic = ivd_ii(inode)->ic;
00279 
00280 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00281     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), pos=%lld, size=%u",
00282 #else
00283     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), pos=%lld, size=%lu",
00284 #endif
00285             current->pid, task_pgrp_nr(current),
00286             inode->i_ino, inode->i_generation, offset, size);
00287 
00288     if (ivdfs_is_offline(inode, offset, size)) {
00289         if (task_pgrp_nr(current) == ic->tgid) {
00290             ivd_dbg(DBG_INV_IO,
00291                 "InvIO[%d,%d]: data_offl on ivdfs_file_aio_read()",
00292                 current->pid, task_pgrp_nr(current));
00293         }
00294         else {
00295             if (ivdfs_evt_data_offl(kiocb->ki_filp->f_dentry,
00296                 offset, size, HSM_CAUSE_OFFLINE) != 0) {
00297                 ret = -EIVDBUSY;
00298                 ivd_dbg(DBG_INV_IO, "vdfs_file_aio_read: File is still offline, returning %d", ret);
00299                 return ret;
00300             }
00301         }
00302     }
00303     if (ic->fs->b_op->f_file->aio_read)
00304         ret = ic->fs->b_op->f_file->aio_read(kiocb, iovec, size, offset);
00305 
00306     ivd_dbg(DBG_VFS, "ret=%d", ret);
00307 
00308     return ret;
00309 }

Here is the call graph for this function:

Here is the caller graph for this function:

ssize_t ivdfs_file_aio_write ( struct kiocb *  kiocb,
const struct iovec *  iovec,
unsigned long  size,
loff_t  offset 
)

Definition at line 314 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_EVT_DETAIL, DBG_INV_IO, DBG_VFS, EIVDBUSY, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, HSM_CAUSE_OFFLINE, if(), ivd_dbg, ivd_ii, IVD_ISEM_HELD, ivdfs_evt_chg_data(), ivdfs_evt_data_offl(), ivdfs_is_offline, ivdfs_mark_dirty(), and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_file_ops().

00316 {
00317     ssize_t     ret = -ENOSYS;
00318     struct inode* inode = kiocb->ki_filp->f_dentry->d_inode;
00319     ivd_comm_t *ic = ivd_ii(inode)->ic;
00320     bool isInvIO = (task_pgrp_nr(current) == ic->tgid);
00321 
00322 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00323     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), pos=%lld, size=%u",
00324 #else
00325     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), pos=%lld, size=%lu",
00326 #endif
00327             current->pid, task_pgrp_nr(current),
00328             inode->i_ino, inode->i_generation, offset, size);
00329 
00330     if (ivdfs_is_offline(inode, offset, size)) {
00331         if (isInvIO) {
00332             ivd_dbg(DBG_INV_IO,
00333                 "InvIO[%d,%d]: data_offl on ivdfs_file_aio_write()",
00334                 current->pid, task_pgrp_nr(current));
00335         }
00336         else {
00337             if (ivdfs_evt_data_offl(kiocb->ki_filp->f_dentry,
00338                 offset, size, HSM_CAUSE_OFFLINE) != 0) {
00339                 ret = -EIVDBUSY;
00340                 ivd_dbg(DBG_INV_IO, "ivdfs_file_aio_write: File is still offline, returning %d", ret);
00341                 return ret;
00342             }
00343         }
00344     }
00345     if (ic->fs->b_op->f_file->aio_write) {
00346         ret = ic->fs->b_op->f_file->aio_write(kiocb, iovec, size, offset);
00347     }
00348 
00349     if (ret && !isInvIO) {
00350         if (ivdfs_mark_dirty(inode, offset, ret, IVD_ISEM_HELD) > 0) {
00351             (void) ivdfs_evt_chg_data(inode, offset, ret); /* TODO: err */
00352         }
00353         else {
00354             ivd_dbg(DBG_EVT_DETAIL, "Data change, but no event and update");
00355         }
00356     }
00357     ivd_dbg(DBG_VFS, "ret=%d", ret);
00358 
00359     return ret;
00360 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_file_dir_notify ( struct file file,
unsigned long  arg 
)

Definition at line 624 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_file_ops().

00625 {
00626     int ret = -ENOSYS;
00627     struct inode* inode = file->f_dentry->d_inode;
00628     ivd_comm_t *ic = ivd_ii(inode)->ic;
00629 
00630     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u)",
00631             current->pid, task_pgrp_nr(current),
00632             inode->i_ino, inode->i_generation);
00633 
00634     if (ic->fs->b_op->f_file->dir_notify)
00635         ret = ic->fs->b_op->f_file->dir_notify(file, arg);
00636 
00637     return ret;
00638 }

Here is the caller graph for this function:

int ivdfs_file_fasync ( int  fd,
struct file file,
int  on 
)

Definition at line 482 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_file_ops().

00483 {
00484     int ret = -ENOSYS;
00485     struct inode* inode = file->f_dentry->d_inode;
00486     ivd_comm_t *ic = ivd_ii(inode)->ic;
00487 
00488     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u)",
00489             current->pid, task_pgrp_nr(current),
00490             inode->i_ino, inode->i_generation);
00491 
00492     if (ic->fs->b_op->f_file->fasync)
00493         ret = ic->fs->b_op->f_file->fasync(fd, file, on);
00494 
00495     return ret;
00496 }

Here is the caller graph for this function:

int ivdfs_file_flock ( struct file file,
int  cmd,
struct file_lock *  file_lock 
)

Definition at line 548 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_file_ops().

00549 {
00550 
00551     int ret = -ENOSYS;
00552     struct inode* inode = file->f_dentry->d_inode;
00553     ivd_comm_t *ic = ivd_ii(inode)->ic;
00554 
00555     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u)",
00556             current->pid, task_pgrp_nr(current),
00557             inode->i_ino, inode->i_generation);
00558 
00559     if (ic->fs->b_op->f_file->flock)
00560         ret = ic->fs->b_op->f_file->flock(file, cmd, file_lock);
00561 
00562     return ret;
00563 }

Here is the caller graph for this function:

int ivdfs_file_flush ( struct file file,
fl_owner_t  id 
)

Definition at line 516 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_file_ops().

00517 {
00518     int ret = -ENOSYS;
00519     struct inode* inode = file->f_dentry->d_inode;
00520     ivd_comm_t *ic = ivd_ii(inode)->ic;
00521 
00522     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u)",
00523             current->pid, task_pgrp_nr(current),
00524             inode->i_ino, inode->i_generation);
00525 
00526     if (ic->fs->b_op->f_file->flush)
00527         ret = ic->fs->b_op->f_file->flush(file, id);
00528 
00529     return ret;
00530 }

Here is the caller graph for this function:

int ivdfs_file_fsync ( struct file file,
struct dentry *  de,
int  datasync 
)

Definition at line 466 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_file_ops().

00467 {
00468     int ret = -ENOSYS;
00469     struct inode* inode = file->f_dentry->d_inode;
00470     ivd_comm_t *ic = ivd_ii(inode)->ic;
00471 
00472     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u)",
00473             current->pid, task_pgrp_nr(current),
00474             inode->i_ino, inode->i_generation);
00475 
00476     if (ic->fs->b_op->f_file->fsync)
00477         ret = ic->fs->b_op->f_file->fsync(file, de, datasync);
00478 
00479     return ret;
00480 }

Here is the caller graph for this function:

unsigned long ivdfs_file_get_unmapped_area ( struct file file,
unsigned long  addr,
unsigned long  len,
unsigned long  offset,
unsigned long  flags 
)

Definition at line 605 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_file_ops().

00606 {
00607     unsigned long ret = -ENOSYS;
00608     struct inode* inode = file->f_dentry->d_inode;
00609     ivd_comm_t *ic = ivd_ii(inode)->ic;
00610 
00611     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u)",
00612             current->pid, task_pgrp_nr(current),
00613             inode->i_ino, inode->i_generation);
00614 
00615     if (ic->fs->b_op->f_file->get_unmapped_area) {
00616         ret = ic->fs->b_op->f_file->get_unmapped_area(file, addr, len, offset, flags);
00617     }
00618 
00619     ivd_dbg(DBG_VFS, "ret=%lu", ret);
00620 
00621     return ret;
00622 }

Here is the caller graph for this function:

int ivdfs_file_ioctl ( struct inode *  inode,
struct file file,
unsigned int  cmd,
unsigned long  arg 
)

Definition at line 172 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_d_file_ops(), and ivdfs_set_f_file_ops().

00174 {
00175     ivd_comm_t *ic = ivd_ii(inode)->ic;
00176     int ret = -ENOSYS;
00177 
00178     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), cmd=0x%X",
00179             current->pid, task_pgrp_nr(current),
00180             inode->i_ino, inode->i_generation, cmd);
00181 
00182     if (ic->fs->b_op->f_file->ioctl)
00183         ret = ic->fs->b_op->f_file->ioctl(inode, file, cmd, arg);
00184 
00185     return ret;
00186 }

Here is the caller graph for this function:

int ivdfs_file_lock ( struct file file,
int  cmd,
struct file_lock *  file_lock 
)

Definition at line 532 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_file_ops().

00533 {
00534     int ret = -ENOSYS;
00535     struct inode* inode = file->f_dentry->d_inode;
00536     ivd_comm_t *ic = ivd_ii(inode)->ic;
00537 
00538     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u)",
00539             current->pid, task_pgrp_nr(current),
00540             inode->i_ino, inode->i_generation);
00541 
00542     if (ic->fs->b_op->f_file->lock)
00543         ret = ic->fs->b_op->f_file->lock(file, cmd, file_lock);
00544 
00545     return ret;
00546 }

Here is the caller graph for this function:

int ivdfs_file_mmap ( struct file file,
struct vm_area_struct *  vma 
)

Definition at line 432 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, ivd_ii, IVD_KEEP_TIME, and ivdfs_mark_dirty().

Referenced by ivdfs_set_f_file_ops().

00433 {
00434     int ret = -ENOSYS;
00435     struct inode* inode = file->f_dentry->d_inode;
00436     ivd_comm_t *ic = ivd_ii(inode)->ic;
00437 
00438     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), vm_flags=0x%lx, pg=%lu, size=%lu",
00439             current->pid, task_pgrp_nr(current),
00440             inode->i_ino, inode->i_generation,
00441             vma->vm_flags, vma->vm_pgoff,
00442             vma->vm_end - vma->vm_start
00443            );
00444 
00445     if (ic->fs->b_op->f_file->mmap)
00446         ret = ic->fs->b_op->f_file->mmap(file,vma);
00447 
00448     /*
00449     If mmap is done for writing (vma->vm_flags & VM_WRITE) then mark this file
00450     as dirty without sending event at this point.
00451     */
00452     if (ret == 0 && (vma->vm_flags & VM_WRITE) == VM_WRITE) {
00453         loff_t size = i_size_read(inode);
00454         ivdfs_mark_dirty(inode, 0, size, IVD_KEEP_TIME);
00455     }
00456     return ret;
00457 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_file_open ( struct inode *  inode,
struct file file 
)

Definition at line 52 of file ivdfs_file.c.

References ivd_fs_t::b_op, CHECK_FILE_ACCESS, DBG_INV_IO, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, hsmfs_new_on_open, ivd_dbg, ivd_ii, IVD_IIF_NEW_ENTRY, ivdfs_evt_open(), ivdfs_evt_simulate_create(), ivdfs_NEW_ON_OPEN_NONE_d, and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_file_ops().

00053 {
00054     ivd_comm_t *ic = ivd_ii(inode)->ic;
00055     int ret = -ENOSYS;
00056 
00057     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), name=%s",
00058             current->pid, task_pgrp_nr(current),
00059             inode->i_ino, inode->i_generation, file->f_dentry->d_name.name);
00060 
00061     ivd_dbg(DBG_VFS, "ctime=%lu:%lu mtime=%lu:%lu f_flags=0x%08X",
00062             inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
00063             inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
00064             file->f_flags);
00065 
00066     if ( (hsmfs_new_on_open != ivdfs_NEW_ON_OPEN_NONE_d)   // new-on-open mode
00067         && (ivd_ii(inode)->flags & IVD_IIF_NEW_ENTRY) ) {  // no EAs up to now
00068         if (task_pgrp_nr(current) != ic->tgid) {
00069             // to prevent sending event when HSM reads file for migration
00070             // such case can happen if inode was removed from cache since first event was sent
00071             ivdfs_evt_simulate_create(list_entry(inode->i_dentry.next, struct dentry, d_alias));
00072         }
00073         else {
00074             ivd_dbg(DBG_INV_IO,
00075                 "InvIO[%d,%d]: NEW_ENTRY, new-on-open: %d -> Create event not sent.",
00076                 current->pid, task_pgrp_nr(current), hsmfs_new_on_open);
00077         }
00078     }
00079 
00080     if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
00081         CHECK_FILE_ACCESS( ic, inode, file, "write" )
00082     }
00083 
00084     if (ic->fs->b_op->f_file->open)
00085         ret = ic->fs->b_op->f_file->open(inode, file);
00086 
00087     if (!ret) {
00088         if (task_pgrp_nr(current) == ic->tgid) {
00089             ivd_dbg(DBG_INV_IO,
00090                 "InvIO[%d,%d]: open()",
00091                 current->pid, task_pgrp_nr(current));
00092             if((file->f_flags & O_ACCMODE) != O_RDONLY) { // release or recall
00093                 ivd_ii(inode)->org_ctime = inode->i_ctime;
00094                 ivd_ii(inode)->org_mtime = inode->i_mtime;
00095             }
00096         }
00097         else {
00098             ivd_ii(inode)->o_count++;
00099 #if 0   // Open event not used anymore/for now
00100             (void) ivdfs_evt_open(file); /* TODO: error code */
00101 #endif
00102         }
00103     }
00104 
00105     return ret;
00106 }

Here is the call graph for this function:

Here is the caller graph for this function:

ssize_t ivdfs_file_read ( struct file file,
char __user *  buf,
size_t  size,
loff_t *  offset 
)

Definition at line 237 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_INV_IO, DBG_VFS, EIVDBUSY, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, HSM_CAUSE_OFFLINE, ivd_dbg, ivd_ii, ivdfs_evt_data_offl(), ivdfs_is_offline, and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_file_ops().

00238 {
00239     ssize_t ret = -ENOSYS;
00240     struct inode* inode = file->f_dentry->d_inode;
00241     ivd_comm_t *ic = ivd_ii(inode)->ic;
00242 
00243     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), pos=%lld, size=%u",
00244             current->pid, task_pgrp_nr(current),
00245             inode->i_ino, inode->i_generation, *offset, size);
00246 
00247     if (ivdfs_is_offline(inode, *offset, size)) {
00248         if (task_pgrp_nr(current) == ic->tgid) {
00249             ivd_dbg(DBG_INV_IO,
00250                 "InvIO[%d,%d]: data_offl on ivdfs_file_read()",
00251                 current->pid, task_pgrp_nr(current));
00252         }
00253         else {
00254             if (ivdfs_evt_data_offl(file->f_dentry,
00255                 *offset, size, HSM_CAUSE_OFFLINE) != 0) {
00256                 ret = -EIVDBUSY;
00257                 ivd_dbg(DBG_INV_IO, "ivdfs_file_read: File is still offline, returning %d", ret);
00258                 return ret;
00259             }
00260         }
00261     }
00262     if (ic->fs->b_op->f_file->read)
00263         ret = ic->fs->b_op->f_file->read(file, buf, size, offset);
00264 
00265     ivd_dbg(DBG_VFS, "ret=%d", ret);
00266 
00267     return ret;
00268 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_file_release ( struct inode *  inode,
struct file file 
)

Definition at line 109 of file ivdfs_file.c.

References ivd_fs_t::b_op, CHECK_FILE_ATTR_DATA, ivd_inode_info_t::chg_time, DBG_INV_IO, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_inode_info_t::flags, ivd_comm_t::fs, hsmfs_chg_data_interval, ivd_inode_info_t::ic, ivd_dbg, ivd_ii, IVD_IIF_DIRTY, ivdfs_evt_chg_data(), ivd_inode_info_t::o_count, ivd_inode_info_t::org_ctime, ivd_inode_info_t::org_mtime, size, and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_file_ops().

00110 {
00111     ivd_inode_info_t *ii = ivd_ii(inode);
00112     ivd_comm_t *ic = ii->ic;
00113     int ret = -ENOSYS;
00114 
00115     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), name=%s",
00116             current->pid, task_pgrp_nr(current),
00117             inode->i_ino, inode->i_generation, file->f_dentry->d_name.name);
00118 
00119     if (ic->fs->b_op->f_file->release)
00120         ret = ic->fs->b_op->f_file->release(inode, file);
00121 
00122     ivd_dbg(DBG_VFS, "ctime=%lu:%lu mtime=%lu:%lu f_flags=0x%08X",
00123             inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
00124             inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
00125             file->f_flags);
00126 
00127     if (!ret) {
00128         if (task_pgrp_nr(current) == ic->tgid) {
00129             ivd_dbg(DBG_INV_IO,
00130                 "InvIO[%d,%d]: release()",
00131                 current->pid, task_pgrp_nr(current));
00132             if((file->f_flags & O_ACCMODE) != O_RDONLY) { // release or recall
00133                 if(!timespec_equal(&(inode->i_ctime), &(ii->org_ctime)) ||
00134                    !timespec_equal(&(inode->i_mtime), &(ii->org_mtime)) ) {
00135 
00136                     inode->i_ctime = ii->org_ctime;
00137                     inode->i_mtime = ii->org_mtime;
00138                     ivd_dbg(DBG_VFS,
00139                         "Return previous times back ctime=%lu:%lu mtime=%lu:%lu",
00140                         inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
00141                         inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec);
00142 
00143                     mark_inode_dirty(inode);
00144                 }
00145             }
00146             // else do nothing for migration
00147         }
00148         else {
00149             ii->o_count--;
00150             if (ii->flags & IVD_IIF_DIRTY) {
00151                 if (ii->chg_time.tv_sec + hsmfs_chg_data_interval <= CURRENT_TIME.tv_sec) {
00152                      /*
00153                       mmapped access sets dirty state on mmap(), but it doesn't send
00154                       event at that time. Change data event is sent on file close if
00155                       dirty flag is set.
00156                       We don't have information what was changes, so we pass file size.
00157                      */
00158                     loff_t size = i_size_read(inode);
00159 
00160                     (void) ivdfs_evt_chg_data(inode, 0, size);
00161                 }
00162             }
00163 
00164             CHECK_FILE_ATTR_DATA(ic, inode, file)
00165         }
00166     }
00167 
00168     return ret;
00169 }

Here is the call graph for this function:

Here is the caller graph for this function:

ssize_t ivdfs_file_sendpage ( struct file file,
struct page *  page,
int  offset,
size_t  size,
loff_t *  pos,
int  more 
)

Definition at line 586 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_file_ops().

00587 {
00588     ssize_t ret = -ENOSYS;
00589     struct inode* inode = file->f_dentry->d_inode;
00590     ivd_comm_t *ic = ivd_ii(inode)->ic;
00591 
00592     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), offset=%d, size=%u, pos=%lld, more=%d",
00593             current->pid, task_pgrp_nr(current),
00594             inode->i_ino, inode->i_generation, offset, size, *pos, more);
00595 
00596     if (ic->fs->b_op->f_file->sendpage) {
00597         ret = ic->fs->b_op->f_file->sendpage(file, page, offset, size, pos, more);
00598     }
00599 
00600     ivd_dbg(DBG_VFS, "ret=%d", ret);
00601 
00602     return ret;
00603 }

Here is the caller graph for this function:

ssize_t ivdfs_file_write ( struct file file,
const char __user *  buf,
size_t  size,
loff_t *  offset 
)

Definition at line 189 of file ivdfs_file.c.

References ivd_fs_t::b_op, DBG_EVT_DETAIL, DBG_INV_IO, DBG_VFS, EIVDBUSY, ivd_fs_b_ops_t::f_file, ivd_comm_t::fs, HSM_CAUSE_OFFLINE, ivd_dbg, ivd_ii, IVD_ISEM_HELD, ivdfs_evt_chg_data(), ivdfs_evt_data_offl(), ivdfs_is_offline, ivdfs_mark_dirty(), and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_file_ops().

00190 {
00191     ssize_t     ret = -ENOSYS;
00192     struct inode* inode = file->f_dentry->d_inode;
00193     ivd_comm_t *ic = ivd_ii(inode)->ic;
00194     bool isInvIO = (task_pgrp_nr(current) == ic->tgid);
00195 
00196     ivd_dbg(DBG_VFS, "[%d,%d] ino=%lu (%u), pos=%lld, size=%u",
00197             current->pid, task_pgrp_nr(current),
00198             inode->i_ino, inode->i_generation, *offset, size);
00199 
00200     ivd_dbg(DBG_INV_IO,
00201         "InvIO[%d,%d]: test. ic->tgid = %d",
00202         ic->tgid,
00203         current->pid, task_pgrp_nr(current));
00204     if (ivdfs_is_offline(inode, *offset, size)) {
00205         if (isInvIO) {
00206             ivd_dbg(DBG_INV_IO,
00207                 "InvIO[%d,%d]: data_offl on ivdfs_file_write()",
00208                 current->pid, task_pgrp_nr(current));
00209         }
00210         else {
00211             if (ivdfs_evt_data_offl(file->f_dentry,
00212                 *offset, size, HSM_CAUSE_OFFLINE) != 0) {
00213                 ret = -EIVDBUSY;
00214                 ivd_dbg(DBG_INV_IO, "ivdfs_file_write: File is still offline, returning %d", ret);
00215                 return ret;
00216             }
00217         }
00218     }
00219     if (ic->fs->b_op->f_file->write) {
00220         ret = ic->fs->b_op->f_file->write(file, buf, size, offset);
00221     }
00222     if (ret && !isInvIO) {
00223         if (ivdfs_mark_dirty(inode, *offset, ret, IVD_ISEM_HELD) > 0) {
00224             (void) ivdfs_evt_chg_data(inode, *offset, ret); /* TODO: err */
00225         }
00226         else {
00227             ivd_dbg(DBG_EVT_DETAIL, "Data change, but no event and update");
00228         }
00229     }
00230 
00231     ivd_dbg(DBG_VFS, "ret=%d", ret);
00232 
00233     return ret;
00234 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_follow_link ( struct dentry *  de,
struct nameidata *  nd 
)

Definition at line 827 of file ivdfs_inode.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::s_inode.

00828 {
00829     ivd_comm_t *ic = ivd_ii(de->d_inode)->ic;
00830 
00831     ivd_dbg(DBG_VFS, "ino=%lu (%u), name=%s",
00832             de->d_inode->i_ino, de->d_inode->i_generation, de->d_iname);
00833 
00834     if (ic->fs->b_op->s_inode->follow_link) {
00835         ic->fs->b_op->s_inode->follow_link(de, nd);
00836     }
00837 }

int ivdfs_get_fileid ( ivd_comm_t ic,
UInt64_t  id_fs,
UInt64_t file_id,
UInt64_t chunk_size 
)

Definition at line 626 of file ivdfs_hsmattr.c.

References DBG_II, DBG_II_DETAIL, hsmfs_iget(), ivd_dbg, ivd_err, IVD_FILE_GEN, IVD_FILE_INO, ivd_ii, ivd_warn, ivd_comm_t::minor, NULL, and ivd_comm_t::sb.

Referenced by ivdfs_dev_ioctl().

00628 {
00629     int ret = 0;
00630     struct inode *inode = NULL;
00631 
00632     ivd_dbg(DBG_II_DETAIL, "<%u> ino=%u (%u)",
00633             ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00634 
00635     if (!ic->sb) {
00636         ivd_err("<%u> device not mounted - ino=%u (%u)",
00637                 ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00638         return -ENODEV;
00639     }
00640 
00641     inode = hsmfs_iget(ic->sb, IVD_FILE_INO(id_fs));
00642     if (IS_ERR(inode)) {
00643         ivd_warn("<%u> inode not found - ino=%u (%u)",
00644                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00645         return PTR_ERR(inode);
00646     }
00647 
00648     if (is_bad_inode(inode)) {
00649         ivd_dbg(DBG_II, "<%u> bad inode: ino=%u (%u)",
00650                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00651         ret = -ENXIO;
00652         goto out;
00653     }
00654 
00655     if (inode->i_generation != IVD_FILE_GEN(id_fs)) {
00656         ivd_warn("<%u> invalid inode gen: ino=%u (%u) i_gen=%u",
00657                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs),
00658                 inode->i_generation);
00659         ret = -ENXIO;
00660         goto out;
00661     }
00662 
00663     *file_id    = ivd_ii(inode)->file_id;
00664     *chunk_size = ivd_ii(inode)->chunk_size;
00665 
00666     ivd_dbg(DBG_II, "<%u> ino=%u (%u) id=%llu, ch_size=%llu",
00667             ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs),
00668             ivd_ii(inode)->file_id, ivd_ii(inode)->chunk_size);
00669 
00670     ret = 0;
00671 
00672 out:
00673     iput(inode);
00674     return ret;
00675 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_get_fileinfo ( ivd_comm_t ic,
unsigned long  ino,
ivd_ioc_fileinfo_t fi 
)

Definition at line 807 of file ivdfs_hsmattr.c.

References ivd_ioc_fileinfo_t::chg_time, ivd_inode_info_t::chunk_size, ivd_ioc_fileinfo_t::chunk_size, DBG_II, DBG_II_DETAIL, ivd_inode_info_t::file_id, ivd_ioc_fileinfo_t::file_id, ivd_ioc_fileinfo_t::file_mode, ivd_ioc_fileinfo_t::file_size, ivd_inode_info_t::flags, ivd_ioc_fileinfo_t::flags, hsmfs_iget(), ivd_ioc_fileinfo_t::id_fs, ivd_dbg, ivd_err, IVD_FILE_GEN, IVD_FILE_ID_FS, IVD_FILE_INO, ivd_ii, IVD_IIF_DIRTY, IVD_IIF_OFFLINE, ivd_warn, ivdfs_bad_cookie(), max, ivd_comm_t::minor, NULL, and ivd_comm_t::sb.

Referenced by ivdfs_dev_ioctl().

00808 {
00809     int ret = 0;
00810     struct inode *inode = NULL;
00811     ivd_inode_info_t *hsmfs_ii = NULL;
00812 
00813     ivd_dbg(DBG_II_DETAIL, "<%u> ino=%lu",
00814             ic->minor, ino);
00815 
00816     if (!ic->sb) {
00817         ivd_err("<%u> device not mounted - ino=%lu",
00818                 ic->minor, ino);
00819         return -ENODEV;
00820     }
00821 
00822     inode = hsmfs_iget(ic->sb, ino);
00823     if (IS_ERR(inode)) {
00824         ivd_dbg(DBG_II_DETAIL, "<%u> inode not found - ino=%lu err=%ld",
00825                  ic->minor, ino, PTR_ERR(inode));
00826         return PTR_ERR(inode);
00827     }
00828 
00829     if (is_bad_inode(inode)) {
00830         ivd_dbg(DBG_II,"<%u> bad inode: ino=%lu",
00831                  ic->minor, ino);
00832         ret = -ENXIO;
00833         goto out;
00834     }
00835 
00836     hsmfs_ii = ivd_ii(inode);
00837 
00838     if (ivdfs_bad_cookie(hsmfs_ii)) {
00839         ivd_warn("<%u> Bad HSMFS cookie for inode=%lu", ic->minor, ino);
00840         ret = -EFAULT;
00841         goto out;
00842     }
00843 
00844     fi->id_fs       = IVD_FILE_ID_FS(inode->i_ino, inode->i_generation);
00845     fi->file_id     = hsmfs_ii->file_id;
00846     fi->chunk_size  = hsmfs_ii->chunk_size;
00847     fi->flags       = 0;
00848     if (hsmfs_ii->flags & IVD_IIF_DIRTY) {
00849         fi->flags   |= IVD_IIF_DIRTY;
00850     }
00851     if (hsmfs_ii->flags & IVD_IIF_OFFLINE) {
00852         fi->flags   |= IVD_IIF_OFFLINE;
00853     }
00854     // We do not have chg_time -> use max(mtime, ctime).
00855     // NOTE: The comparison is done on the level of seconds.
00856     fi->chg_time = max(inode->i_mtime.tv_sec, inode->i_ctime.tv_sec);
00857     fi->file_mode   = inode->i_mode;
00858     fi->file_size   = inode->i_size;
00859 
00860     ivd_dbg(DBG_II,
00861             "<%u> ino=%u (%u) id=%llu, ch_size=%llu, flags=%#x, "
00862             "chg_time=%u, f_mode=%#o, f_size=%llu",
00863             ic->minor, IVD_FILE_INO(fi->id_fs), IVD_FILE_GEN(fi->id_fs),
00864             fi->file_id, fi->chunk_size, fi->flags,
00865             fi->chg_time, fi->file_mode, fi->file_size);
00866 
00867     ret = 0;
00868 
00869 out:
00870     iput(inode);
00871     return ret;
00872 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int ivdfs_get_path ( struct dentry *  de,
char *  buf,
int  buflen 
) [static]

Definition at line 49 of file ivdfs_events.c.

References ALIGN_FILE, DBG_EVT, DBG_EVT_DETAIL, ivd_file_t::file_id, hsmfs_new_on_open, ivd_file_t::id_fs, ivd_dbg, ivd_err, IVD_FILE_ID_FS, ivd_ii, IVD_IIF_NEW_ENTRY, ivdfs_NEW_ON_OPEN_ALL_d, ivd_file_t::len, len, ivd_path_t::levels, ivd_file_t::name, and NULL.

Referenced by ivdfs_evt_chg_attr(), ivdfs_evt_chg_data(), ivdfs_evt_chg_name(), ivdfs_evt_data_offl(), ivdfs_evt_open(), and ivdfs_evt_release().

00050 {
00051     int len;
00052     int pathlen = 0;
00053     unsigned short level = 0;
00054     ivd_file_t *f;
00055     ivd_path_t *p;
00056     char *pos = buf;
00057 
00058     ivd_dbg(DBG_EVT, "de=%s", de ? de->d_name.name : NULL);
00059 
00060     /* skip path header (levels) - fill at the end */
00061     pos += sizeof(ivd_path_t) - sizeof(ivd_file_t);
00062 
00063 //#warning "dcache lock is locked for each of the events --> hsmfs slows down the system"
00064 
00065     if (de) {
00066         spin_lock(&dcache_lock);
00067 
00068         do {
00069             level++;
00070             ivd_dbg(DBG_EVT_DETAIL, "%d: ino=%lu (%u) name=\"%s\"",
00071                     level,
00072                     de->d_inode ? de->d_inode->i_ino : 0,
00073                     de->d_inode ? de->d_inode->i_generation : 0,
00074                     de->d_name.name);
00075             /* 4455 fix */
00076             if ( (level > 1)                                            // file's parents
00077                 && (hsmfs_new_on_open == ivdfs_NEW_ON_OPEN_ALL_d)       // new-on-open mode 2
00078                 && (ivd_ii(de->d_inode)->flags & IVD_IIF_NEW_ENTRY) ) { // no EAs up to now
00079                 ivd_dbg(DBG_EVT_DETAIL, "New entry flag removed.");
00080                 ivd_ii(de->d_inode)->flags &= ~IVD_IIF_NEW_ENTRY;
00081             }
00082 
00083             f = (ivd_file_t *)pos;
00084             if (de->d_inode) {
00085                 f->id_fs    = IVD_FILE_ID_FS(de->d_inode->i_ino,
00086                                              de->d_inode->i_generation);
00087                 f->file_id  = ivd_ii(de->d_inode)->file_id;
00088             }
00089             else {
00090                 f->id_fs    = 0;
00091                 f->file_id  = 0;
00092             }
00093             pathlen += f->len = de->d_name.len+1;
00094 
00095             len = ALIGN_FILE(sizeof(ivd_file_t) + f->len);
00096 
00097             /* To prevent buffer overrun  (Bug 3453)*/
00098             if ( (pos + len - buf) > buflen ) {
00099                 ivd_err("IVD path buffer too small (%d, but %d required). Event ignored.", buflen, (pos + len - buf));
00100                 spin_unlock(&dcache_lock);
00101                 return -ENAMETOOLONG;
00102             }
00103             memcpy(f->name, de->d_name.name, f->len);
00104 
00105             pos += len;
00106 
00107             de = de->d_parent;
00108 
00109         } while (!IS_ROOT(de));
00110 
00111         spin_unlock(&dcache_lock);
00112     }
00113 
00114     p = (ivd_path_t *)buf;
00115     p->levels = level;
00116 
00117     return(pos - buf);
00118 }

Here is the caller graph for this function:

int ivdfs_get_sb ( struct file_system_type *  fst,
int  flags,
const char *  dev_name,
void *  data,
struct vfsmount *  mnt 
)

The mount function of the file system.

Returns:
Error code. Value 0 means success.

Definition at line 138 of file ivdfs_mod.c.

References ivd_fs_t::b_fst, DBG_MAIN, ivd_fs_t::flags, ivd_comm_t::fs, FSTYPE_SLEN, HSM_OPMODE_REGULAR, hsmfs_timeout, ivd_alert, IVD_BFS_NEEDS_USER_XATTR, ivd_dbg, ivd_err, ivd_get_comm(), ivd_get_fs(), ivd_info, ivd_put_comm(), ivd_put_fs(), ivdfs_evt_mount(), ivdfs_evt_pre_mount(), ivdfs_parse_options(), ivdfs_set_inode_ops(), ivdfs_set_super_ops(), ivdfs_setopmode(), ivd_comm_t::minor, NULL, and ivd_comm_t::sb.

00144 {
00145 
00146     void *options = NULL;
00147     int opt_len = 0;
00148 
00149     dev_t   fs_device = 0;
00150     char    base_fs_name[FSTYPE_SLEN+1] = "ext3";  // if not specified, use ext3
00151     int     retVal = 0;
00152 
00153     ivd_fs_t    *ifs = NULL;
00154     ivd_comm_t  *ic = NULL;
00155     int ret;
00156 
00157     ivd_dbg(DBG_MAIN, "%s: mounting (fst->name=%s).", dev_name, fst->name);
00158 
00159     if (!ivdfs_parse_options(data, base_fs_name))
00160         goto err;
00161 
00162     if (data != NULL) {
00163         opt_len += strlen(data)+1;
00164     }
00165 
00166     /* get bottom FS type in internal fs_ops table */
00167     ifs = ivd_get_fs(base_fs_name);
00168     if (ifs == NULL) {
00169         goto err;
00170     }
00171 
00172     ivd_dbg(DBG_MAIN, "%s: acquiring device ids", dev_name);
00173     /* Get device numbers from dev_name*/
00174     {
00175         struct block_device     *bdev = NULL;
00176         bdev = open_bdev_excl(dev_name, flags, ifs->b_fst);
00177         if (IS_ERR(bdev)) {
00178             ivd_dbg(DBG_MAIN, "%s: open_bdev_excl returned %d", dev_name, (int)bdev);
00179             return PTR_ERR(bdev);
00180         }
00181         fs_device = bdev->bd_dev;
00182 
00183         close_bdev_excl(bdev);
00184     }
00185 
00186     {
00187         char b[BDEVNAME_SIZE];
00188         ivd_dbg(DBG_MAIN, "%s: device major, minor: %s:", dev_name, __bdevname(fs_device, b));
00189     }
00190 
00191     /* allocate pseudo device for communication with user space (starts HSM)*/
00192     ic = ivd_get_comm(fs_device);
00193     if (ic == NULL) {
00194         goto err;
00195     }
00196 
00197     if (ifs->flags & IVD_BFS_NEEDS_USER_XATTR) {
00198         opt_len += strlen("user_xattr");
00199         opt_len++; /* this one is either for the comma or for /0 */
00200     }
00201     ivd_dbg(DBG_MAIN, "optlen=%d.", opt_len);
00202 
00203     if (opt_len > 0) {
00204         options = kmalloc(opt_len, GFP_KERNEL);
00205 
00206         if (options == NULL) {
00207             ivd_err("Cannot allocate memory (size=%d)", opt_len);
00208             goto err;
00209         }
00210 
00211         if (ifs->flags & IVD_BFS_NEEDS_USER_XATTR) {
00212 
00213             ivd_dbg(DBG_MAIN, "Adding user_xattr option to %s.", (char *)data);
00214 
00215             if (data != NULL) {
00216                 strcpy(options, data);
00217                 strcat(options, ",");
00218                 strcat(options, "user_xattr");
00219             }
00220             else {
00221                 strcpy(options, "user_xattr");
00222             }
00223         }
00224         else {
00225             strcpy(options, data);
00226         }
00227     }
00228     ivd_dbg(DBG_MAIN, "options=%s", (char *)options);
00229 
00230     ivdfs_setopmode(ic, HSM_OPMODE_REGULAR, 0);
00231     /* Will change to IVD_OPMODE_READ_ONLY_NO_RECALL in future.*/
00232 
00233     /* send PreMount event - synchronous (will block until reply or timeout) */
00234     ret = ivdfs_evt_pre_mount(NULL, fs_device, ic->minor, dev_name);
00235     if (ret != 0) {
00236         char b[BDEVNAME_SIZE];
00237         if (ret == -ERESTARTSYS) {
00238             ivd_alert("%s: ivd-hsm did not respond in %ds for mount request.",
00239                       __bdevname(fs_device, b), hsmfs_timeout);
00240         }
00241         else {
00242             ivd_alert("%s: cannot mount - denied by ivd-fsevtmgr (code: %d)",
00243                       __bdevname(fs_device, b), ret);
00244         }
00245         goto err;
00246     }
00247 
00248     /* call original super block (do mount) */
00249     retVal = ifs->b_fst->get_sb(ifs->b_fst, flags, dev_name, options, mnt);
00250     if (unlikely(retVal != 0)) {
00251         ivd_alert("Cannot mount bottom FS type: %s, Error: %d.", base_fs_name, retVal);
00252         goto err;
00253     }
00254 
00255     if (options != NULL) {
00256         kfree(options);
00257         options = NULL;
00258     }
00259 
00260     ic->fs = ifs;
00261     ic->sb = mnt->mnt_sb;
00262 
00263     ivd_dbg(DBG_MAIN,
00264         "%s, %s: successfully mounted bottom FS (type: %s).",
00265         dev_name, ic->sb->s_id, base_fs_name);
00266 
00267     ivd_dbg(DBG_MAIN, "%s: FS type OK, comm minor=%u", ic->sb->s_id, ic->minor);
00268 
00269     /* override super operations */
00270     ivdfs_set_super_ops(ic->fs, ic->sb);
00271 
00272     /* override operations for FS root inode */
00273     if (ivdfs_set_inode_ops(ic, ic->sb->s_root->d_inode) != 0)
00274         goto err_unmount;
00275 
00276     // TODO: should we initialize hsm attr and inode info?
00277     // ivdfs_read_inode_info(ic->sb->s_root->d_inode);
00278 
00279     /* successfully mounted - send Mount event */
00280     (void) ivdfs_evt_mount(ic, fs_device, dev_name, 0); /* TODO: what if error? */
00281 
00282     ivd_info("%s: Sucessfully mounted hsmfs (bottom FS type=%s)", ic->sb->s_id, base_fs_name);
00283 
00284     return retVal;
00285 
00286 err_unmount:
00287     // if bottom FS was mounted - umount
00288     if (ic->sb != NULL) {
00289         ivd_err("%s: Unmounting bottom FS type=%s.", ic->sb->s_id, base_fs_name);
00290         if (ic->sb->s_op->put_super) {
00291             ic->sb->s_op->put_super(ic->sb);
00292         }
00293     }
00294 
00295 err:
00296     if (ic != NULL) {
00297         if (ic->sb != NULL) {
00298             /* mount failed - send Mount event with error */
00299             ivd_dbg(DBG_MAIN, "%s: mount failed - sending mount event with error.", dev_name);
00300             (void) ivdfs_evt_mount(ic, fs_device, dev_name, EIO);
00301         }
00302 
00303         if (ic->fs) {
00304            ivd_put_fs(ic->fs);
00305         }
00306 
00307         ivd_put_comm(ic);
00308     }
00309 
00310     if (options != NULL)
00311         kfree(options);
00312 
00313     return -ENODEV;
00314 }

Here is the call graph for this function:

static int __init ivdfs_init ( void   )  [static]

Definition at line 357 of file ivdfs_mod.c.

References hsmfs_chg_data_interval, hsmfs_debug, hsmfs_dev_major, hsmfs_event_alert, hsmfs_import_delay, hsmfs_max_hsm_busy, hsmfs_max_outstanding, hsmfs_max_sleep_time, hsmfs_new_on_open, hsmfs_path_bufsize, hsmfs_sleep_factor, hsmfs_timeout, ivd_alert, ivd_info, ivdfs_CHG_DATA_INTERVAL_d, ivdfs_comm_init(), ivdfs_EVENT_ALERT_d, ivdfs_IMPORT_DELAY_d, ivdfs_MAX_HSM_BUSY_d, ivdfs_MAX_SLEEP_TIME_d, ivdfs_NEW_ON_OPEN_ALL_d, ivdfs_NEW_ON_OPEN_FILES_d, ivdfs_NEW_ON_OPEN_NONE_d, ivdfs_PATH_BUFSIZE_d, ivdfs_slab_init(), ivdfs_SLEEP_FACTOR_d, and ivdfs_vers.

00358 {
00359     int ret=0;
00360 
00361     ivd_info(
00362         "HSM - File System - %u.%u.%u-%u \"%s\"",
00363         ivdfs_vers.major, ivdfs_vers.minor, ivdfs_vers.smr, ivdfs_vers.build, ivdfs_vers.label);
00364 
00365     if (hsmfs_debug) {
00366         ivd_info("%s", ivdfs_vers.moduleVersion);
00367         ivd_info("%s", ivdfs_vers.buildTime);
00368         ivd_info("%s", ivdfs_vers.buildSystem);
00369     }
00370 
00371     if (ivdfs_slab_init() != 0) {
00372         return -1;
00373     }
00374 
00375     ret = register_filesystem(&hsmfs_fstype);
00376     if (ret != 0) {
00377         ivd_alert("[CRITICAL] register_filesystem failed, ret=%d", ret);
00378         return ret;
00379     }
00380     ret = ivdfs_comm_init();
00381     if (ret != 0) {
00382         goto fail;
00383     }
00384 
00385     ivd_info("ivdfs_dev_major=%u, ivdfs_debug=0x%08lX",
00386              hsmfs_dev_major, hsmfs_debug);
00387 
00388     if(   hsmfs_sleep_factor <= 0
00389         || hsmfs_sleep_factor >= 32768) {
00390             ivd_info("hsmfs_sleep_factor=%d and must be 0 < sleep_factor < 32768",
00391                 hsmfs_sleep_factor);
00392             hsmfs_sleep_factor = ivdfs_SLEEP_FACTOR_d;
00393     }
00394 
00395     if(   hsmfs_max_sleep_time <= 0
00396         || hsmfs_max_sleep_time > 30) {
00397             ivd_info("hsmfs_max_sleep_time=%d and must be 0 < hsmfs_max_sleep_time <= 30 (in seconds)",
00398                 hsmfs_max_sleep_time);
00399             hsmfs_max_sleep_time = ivdfs_MAX_SLEEP_TIME_d;
00400     }
00401 
00402     if(   hsmfs_max_hsm_busy <= 0
00403        || hsmfs_max_hsm_busy > 36000) {
00404         ivd_info("hsmfs_max_hsm_busy=%d and must be 0 < max_hsm_busy <= 36000", // 10 hours
00405                 hsmfs_max_hsm_busy);
00406         hsmfs_max_hsm_busy = ivdfs_MAX_HSM_BUSY_d;
00407     }
00408 
00409     if(   hsmfs_import_delay < 1  || hsmfs_import_delay > 5) {
00410         ivd_info("hsmfs_import_delay=%d and must be 0 < hsmfs_import_delay <= 5",
00411                 hsmfs_import_delay);
00412         hsmfs_import_delay = ivdfs_IMPORT_DELAY_d;
00413     }
00414 
00415     if ( (hsmfs_new_on_open != ivdfs_NEW_ON_OPEN_NONE_d)
00416       && (hsmfs_new_on_open != ivdfs_NEW_ON_OPEN_FILES_d)
00417       && (hsmfs_new_on_open != ivdfs_NEW_ON_OPEN_ALL_d) ) {
00418         ivd_info("hsmfs_new_on_open=%d and must be 0, 1 or 2", hsmfs_new_on_open);
00419         hsmfs_new_on_open = ivdfs_NEW_ON_OPEN_FILES_d;
00420     }
00421 
00422     if (hsmfs_chg_data_interval > 600) {
00423         ivd_info("hsmfs_chg_data_interval=%u has to be smaller than 600",
00424                 hsmfs_chg_data_interval);
00425         hsmfs_chg_data_interval = ivdfs_CHG_DATA_INTERVAL_d;
00426     }
00427 
00428     if (hsmfs_event_alert < 10) {
00429         ivd_info("hsmfs_event_alert=%u has to be larger than 10",
00430                 hsmfs_event_alert);
00431         hsmfs_event_alert = ivdfs_EVENT_ALERT_d;
00432     }
00433 
00434     if (hsmfs_path_bufsize < PAGE_SIZE || hsmfs_path_bufsize > 16*PAGE_SIZE) {
00435         ivd_info("hsmfs_path_bufize=%u has to be between %lu and %lu",
00436                 hsmfs_path_bufsize, PAGE_SIZE, 16*PAGE_SIZE);
00437         hsmfs_path_bufsize = ivdfs_PATH_BUFSIZE_d;
00438     }
00439 
00440     ivd_info("hsmfs_max_outstanding=%d, hsmfs_sleep_factor=%d, hsmfs_max_hsm_busy=%d, hsmfs_timeout=%u",
00441              hsmfs_max_outstanding, hsmfs_sleep_factor, hsmfs_max_hsm_busy, hsmfs_timeout);
00442 
00443     ivd_info("hsmfs_import_delay=%d, hsmfs_chg_data_interval=%u, hsmfs_event_alert=%u",
00444              hsmfs_import_delay, hsmfs_chg_data_interval, hsmfs_event_alert);
00445     ivd_info("hsmfs_path_bufsize=%u",
00446              hsmfs_path_bufsize);
00447 
00448     // transform hsmfs_max_sleep_time from seconds to jiffies
00449     hsmfs_max_sleep_time *= HZ;
00450 
00451     return 0;
00452 
00453 fail:
00454     unregister_filesystem(&hsmfs_fstype);
00455     return ret;
00456 }

Here is the call graph for this function:

void ivdfs_init_inode_info ( struct inode *  inode,
int  flags 
)

Definition at line 253 of file ivdfs_hsmattr.c.

References ivd_hsmattr_t::close_time, DBG_II, ivd_dbg, IVD_DONT_WRITE, ivd_ii, IVD_ISEM_HELD, and ivdfs_hsmattr_init.

Referenced by ivdfs_read_inode_info().

00254 {
00255     ivd_hsmattr_t ia;
00256     mode_t org_mode;
00257 
00258     ivd_dbg(DBG_II, "<%u> ino=%lu (%u)",
00259             ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00260 
00261     if (!(flags & IVD_ISEM_HELD)) {
00262         ivd_dbg(DBG_II, "Locking i_mutex.");
00263         mutex_lock(&inode->i_mutex);
00264     }
00265 
00266     ivdfs_hsmattr_init(&ia);
00267     ivd_ii(inode)->close_time = CURRENT_TIME;
00268     ia.close_time = ivd_ii(inode)->close_time.tv_sec;
00269 
00276     org_mode = inode->i_mode;
00277     inode->i_mode |= S_IWUSR;
00278 
00279     if (!(flags & IVD_DONT_WRITE))
00280         ivdfs_hsmattr_write(inode, &ia);
00281 
00282     inode->i_mode = org_mode;
00283 
00284     if (!(flags & IVD_ISEM_HELD))
00285         mutex_unlock(&inode->i_mutex);
00286 }

Here is the caller graph for this function:

static void ivdfs_inode_init ( void *  foo  )  [static]

This is contructor function, which is called for each allocated element in the hsm_ii_cache_p by the slab allocator.

Warning:
This function is called only on first allocation of the slab member and not on subsequent allocations. The allocated memory from slab has to be initialised after using kmem_cache_alloc.

Definition at line 67 of file ivdfs_super.c.

References ivd_inode_info_t::cookie, and hsmfs_cookie.

Referenced by ivdfs_slab_init().

00069 {
00070     ivd_inode_info_t * ii = (ivd_inode_info_t *)foo;
00071 
00072 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00073     if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == SLAB_CTOR_CONSTRUCTOR)
00074 #endif
00075     {
00076         memset(ii, 0, sizeof(ivd_inode_info_t));
00077         memcpy(ii->cookie, hsmfs_cookie, sizeof(ii->cookie));
00078     }
00079 }

Here is the caller graph for this function:

void ivdfs_invalidatepage ( struct page *  page,
unsigned long  offset 
)

Definition at line 368 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_VFS_PAGE, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_addrs_ops().

00369 {
00370     struct inode* inode = page->mapping->host;
00371     ivd_comm_t *ic = ivd_ii(inode)->ic;
00372 
00373     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), pg=%lu",
00374             inode->i_ino, inode->i_generation, page->index);
00375 
00376     if (ic->fs->b_op->f_addrs->invalidatepage)
00377         ic->fs->b_op->f_addrs->invalidatepage(page, offset);
00378 }

Here is the caller graph for this function:

int ivdfs_is_worm_protected ( struct inode *  inode  ) 

Definition at line 1109 of file ivdfs_hsmattr.c.

01110 {
01111     return 0;
01112 }

void ivdfs_kill_sb ( struct super_block *  sb  ) 

Definition at line 316 of file ivdfs_mod.c.

References DBG_VFS, ivd_dbg, ivd_err, ivd_find_comm(), ivd_info, ivd_put_comm(), and ivd_put_fs().

00317 {
00318     ivd_dbg(DBG_VFS, "KILL SB CALLED: dev=%s", sb->s_id);
00319     /*
00320     It seems that the bottom fs kill_sb overrides the hsmfs kill_sb after the
00321     get_sb function of the bottom fs is called, because the VFS doesn't call
00322     this function at all.
00323     */
00324 //#warning "Find out if is this function called at all. Does it need to be implemented at all?"
00325 #if 0
00326     ivd_dbg(DBG_VFS, "dev=%s", sb->s_id);
00327 
00328     if (!(ic = ivd_find_comm(sb->s_dev))) {
00329         ivd_err("Cannot find comm for device %u: can't kill super block.", sb->s_dev);
00330         return;
00331     }
00332 
00333     down_write(&ic->sem);
00334 
00335     if (ic->fs->b_fst->kill_sb)
00336         ic->fs->b_fst->kill_sb(sb);
00337 
00338     ivd_info("%s: killed super block.", sb->s_id);
00339 
00340     ivd_put_fs(ic->fs);
00341     ivd_put_comm(ic);
00342 
00343     up_write(&ic->sem);
00344 #endif
00345 }

Here is the call graph for this function:

int ivdfs_link ( struct dentry *  old_de,
struct inode *  dir,
struct dentry *  de 
)

Definition at line 181 of file ivdfs_inode.c.

References ivd_fs_t::b_op, ivd_fs_b_ops_t::d_inode, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, ivdfs_evt_chg_name(), and NULL.

Referenced by ivdfs_set_d_inode_ops().

00182 {
00183     ivd_comm_t *ic = ivd_ii(dir)->ic;
00184     int ret = -ENOSYS;
00185     struct inode* inode = old_de->d_inode;
00186 
00187     ivd_dbg(DBG_VFS, "dir=%lu (%u), name=%s, ino=%lu (%u)",
00188             dir->i_ino, dir->i_generation, de->d_iname,
00189             inode->i_ino, inode->i_generation);
00190 
00191     // TODO: hard link not supported yet
00192     return -ENOSYS;
00193 
00194     if (ic->fs->b_op->d_inode->link) {
00195         ret = ic->fs->b_op->d_inode->link(old_de, dir, de);
00196     }
00197 
00198     if (!ret) {
00199         (void) ivdfs_evt_chg_name(de, NULL); /* TODO: error code */
00200     }
00201 
00202     return ret;
00203 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_lock_file ( ivd_comm_t ic,
unsigned int  cmd,
UInt64_t  id_fs,
UInt64_t  file_id,
UInt32_t  op,
UInt32_t chg_time,
UInt64_t chunk_size,
UInt32_t flags 
)

Definition at line 876 of file ivdfs_hsmattr.c.

References DBG_II, DBG_LOCK, DBG_LOCK_DETAIL, HSM_IOC_LOCK_FILE, HSM_IOC_UNLOCK_FILE, HSM_OP_MIGRATION, HSM_OP_RELEASE, hsmfs_iget(), ivd_dbg, ivd_err, IVD_FILE_GEN, IVD_FILE_INO, ivd_ii, IVD_IIF_DIRTY, IVD_IIF_OFFLINE, ivd_warn, ivdfs_is_dirty, ivd_comm_t::minor, NULL, and ivd_comm_t::sb.

Referenced by ivdfs_dev_ioctl().

00884 {
00885     int ret = 0;
00886     struct inode *inode = NULL;
00887 
00888     ivd_dbg(
00889         DBG_LOCK_DETAIL,
00890         "<%u> ino=%u (%u), cmd=%#x, id=%llu, op=%u",
00891         ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs),
00892         cmd, file_id, op
00893     );
00894 
00895     if (!ic->sb) {
00896         ivd_err("<%u> device not mounted - ino=%u (%u)",
00897                 ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00898         return -ENODEV;
00899     }
00900 
00901     inode = hsmfs_iget(ic->sb, IVD_FILE_INO(id_fs));
00902     if (IS_ERR(inode)) {
00903         ivd_warn("<%u> inode not found - ino=%u (%u)",
00904                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00905         return PTR_ERR(inode);
00906     }
00907 
00908     if (is_bad_inode(inode)) {
00909         ivd_dbg(DBG_II,"<%u> bad inode: ino=%u (%u)",
00910                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00911         ret = -ENXIO;
00912         goto out;
00913     }
00914 
00915     if (inode->i_generation != IVD_FILE_GEN(id_fs)) {
00916         ivd_warn("<%u> invalid inode gen: ino=%u (%u) i_gen=%u",
00917                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs),
00918                  inode->i_generation);
00919         ret = -ENXIO;
00920         goto out;
00921     }
00922 
00923     if (file_id == 0 || ivd_ii(inode)->file_id != file_id) {
00924         ivd_warn("<%u> file ID mismatch, ino=%lu (%u), ii=%llu: got=%llu",
00925                  ic->minor, inode->i_ino, inode->i_generation,
00926                  ivd_ii(inode)->file_id, file_id);
00927         ret = -ENXIO;
00928         goto out;
00929     }
00930 
00931     if (cmd == HSM_IOC_LOCK_FILE) {
00932         if (op == HSM_OP_MIGRATION) {
00933             ivd_dbg(DBG_LOCK, "<%u> Lock ino=%lu (%u) for migration",
00934                     ic->minor, inode->i_ino, inode->i_generation);
00935 
00936             *chg_time      = ivd_ii(inode)->chg_time.tv_sec;
00937             *chunk_size    = ivd_ii(inode)->chunk_size;
00938             *flags         = 0;
00939             if (ivd_ii(inode)->flags & IVD_IIF_DIRTY) {
00940                *flags   |= IVD_IIF_DIRTY;
00941             }
00942             if (ivd_ii(inode)->flags & IVD_IIF_OFFLINE) {
00943                *flags   |= IVD_IIF_OFFLINE;
00944             }
00945         }
00946         else if (op == HSM_OP_RELEASE) {
00947             ivd_dbg(DBG_LOCK, "<%u> Lock ino=%lu (%u) for release",
00948                     ic->minor, inode->i_ino, inode->i_generation);
00949 
00950             if (ivdfs_is_dirty(inode, 0, 0)) {
00951                 ivd_warn("<%u> Lock ino=%lu (%u) for release FAILED (dirty)",
00952                          ic->minor, inode->i_ino, inode->i_generation);
00953                 ret = -EPERM;
00954             }
00955         }
00956         else {
00957             ivd_err("<%u> Lock ino=%lu (%u) - invalid op=%u",
00958                     ic->minor, inode->i_ino, inode->i_generation, op);
00959         }
00960     }
00961     else if (cmd == HSM_IOC_UNLOCK_FILE) {
00962         if (op == HSM_OP_MIGRATION) {
00963             ivd_dbg(DBG_LOCK, "<%u> Unlock ino=%lu (%u) after migration",
00964                     ic->minor, inode->i_ino, inode->i_generation);
00965         }
00966         else if (op == HSM_OP_RELEASE) {
00967             ivd_dbg(DBG_LOCK, "<%u> Unlock ino=%lu (%u) after release",
00968                     ic->minor, inode->i_ino, inode->i_generation);
00969         }
00970         else {
00971             ivd_err("<%u> Unlock ino=%lu (%u) - invalid op=%u",
00972                     ic->minor, inode->i_ino, inode->i_generation, op);
00973         }
00974     }
00975     else {
00976         ivd_err("<%u> Lock/Unlock ino=%lu (%u) - invalid cmd=%#x",
00977                 ic->minor, inode->i_ino, inode->i_generation, cmd);
00978     }
00979 
00980 out:
00981     iput(inode);
00982     return ret;
00983 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct dentry * ivdfs_lookup ( struct inode *  dir,
struct dentry *  dentry,
struct nameidata *  nd 
) [read]

Definition at line 73 of file ivdfs_inode.c.

References ivd_fs_t::b_op, ivd_fs_b_ops_t::d_inode, DBG_II_DETAIL, DBG_VFS, ivd_comm_t::fs, hsmfs_new_on_open, ivd_alert, ivd_dbg, ivd_ii, IVD_IIF_NEW_ENTRY, ivdfs_attach(), ivdfs_evt_simulate_create(), ivdfs_iopen_check(), ivdfs_NEW_ON_OPEN_ALL_d, ivdfs_NEW_ON_OPEN_FILES_d, ivdfs_NEW_ON_OPEN_NONE_d, NULL, and S_ISREG.

Referenced by ivdfs_set_d_inode_ops().

00075 {
00076     ivd_comm_t *ic = ivd_ii(dir)->ic;
00077     struct dentry* ret = NULL;
00078 
00079     ivd_dbg(DBG_VFS, "dir=%lu (%u), name=%s",
00080             dir->i_ino, dir->i_generation, dentry->d_iname);
00081 
00082     if (ivdfs_iopen_check(dir, dentry)) {
00083        return NULL;
00084     }
00085 
00086     if (ic->fs->b_op->d_inode->lookup) {
00087         ret = ic->fs->b_op->d_inode->lookup(dir, dentry, nd);
00088     }
00089 
00090     ivd_dbg(DBG_VFS, "de addr 0x%p, ret addr 0x%p", dentry, ret);
00091 
00092     // if lookup succeeded, we need to check if this is new entry
00093     // that did not have EA up to now (detected in read_inode())
00094     // ==> simulate create and chg_data (if file) events to notify HSM
00095     if (ret == 0 && dentry->d_inode) {
00096         int setOpsRet = ivdfs_attach(ic, dentry->d_inode);
00097         if (setOpsRet != 0) {
00098             ivd_dbg(DBG_VFS,
00099                     "dir=%lu (%u), name=%s: Failed to hijack inode",
00100                     dir->i_ino, dir->i_generation, dentry->d_iname);
00101             return ERR_PTR(setOpsRet);
00102         }
00103         if (ivd_ii(dentry->d_inode)->flags & IVD_IIF_NEW_ENTRY) {
00104             int comp = strcmp(dentry->d_iname, ".."); // NFS lookup
00105             if (comp != 0) {
00106                 switch (hsmfs_new_on_open) {
00107                     case ivdfs_NEW_ON_OPEN_ALL_d:
00108                         ivd_dbg(DBG_II_DETAIL, "Do not notify HSM.");
00109                         break;
00110                     case ivdfs_NEW_ON_OPEN_FILES_d:
00111                         if (S_ISREG(dentry->d_inode->i_mode)) {
00112                             // Do not send create events for files
00113                             ivd_dbg(DBG_II_DETAIL,
00114                                 "It is a regular file. Do not notify HSM.");
00115                         }
00116                         else {
00117                             ivdfs_evt_simulate_create(dentry);
00118                     }
00119                             break;
00120                         case ivdfs_NEW_ON_OPEN_NONE_d: // old behavior: new on lookup
00121                             ivdfs_evt_simulate_create(dentry);
00122                             break;
00123                         default:
00124                             ivd_alert("[CRITICAL] Unsupported hsmfs_new_on_open mode %d!", hsmfs_new_on_open);
00125                             ivdfs_evt_simulate_create(dentry);
00126                 }
00127             }
00128             else {
00129                 ivd_dbg(DBG_VFS, "NFS lookup. Create event cannot be sent.");
00130             }
00131         }
00132     }
00133 
00134     ivd_dbg(DBG_VFS, "returning");
00135     return ret;
00136 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_mark_clean ( struct inode *  inode,
loff_t  off,
loff_t  pos,
int  flags 
)

Definition at line 569 of file ivdfs_hsmattr.c.

References ivd_inode_info_t::chg_time, ivd_hsmattr_t::chunk_size, ivd_inode_info_t::chunk_size, ivd_inode_info_t::file_id, ivd_hsmattr_t::file_id, ivd_hsmattr_t::flags, ivd_inode_info_t::flags, ivd_inode_info_t::ic, ivd_ii, IVD_IIF_DIRTY, IVD_ISEM_HELD, ivd_nul_time, ivd_warn, ivdfs_bad_cookie(), and ivd_comm_t::minor.

Referenced by ivdfs_data_state(), and ivdfs_truncate().

00569                                                                               {
00570 
00571     ivd_inode_info_t *hsmfs_ii = ivd_ii(inode);
00572 
00573     if (ivdfs_bad_cookie(hsmfs_ii)) {
00574         ivd_warn("<%u> Bad HSMFS cookie for inode=%lu", hsmfs_ii->ic->minor, inode->i_ino);
00575 
00576     }
00577 
00578     // if dirty flag set -> clear and update hsmattr
00579     if (hsmfs_ii->flags & IVD_IIF_DIRTY) {
00580         ivd_hsmattr_t ia;
00581         int ret;
00582 
00583         // update HSM attributes
00584         ret = ivdfs_hsmattr_read(inode, &ia);
00585 
00586         if ((ret < 0) || (ia.file_id == 0)) {
00587             ivd_warn("<%u> Mark ino=%lu (%u) CLEAN failed - "
00588                     "Could not get FileID (ret=%d)!",
00589             hsmfs_ii->ic->minor, inode->i_ino,
00590             inode->i_generation, ret);
00591             return;
00592         }
00593 
00594         // TODO: sanity check: we may want to remove this later
00595         if (hsmfs_ii->file_id != ia.file_id) {
00596             ivd_warn("ino=%lu (%u): file_id mismatch -> ii=%llu, ia=%llu",
00597                      inode->i_ino, inode->i_generation,
00598                      hsmfs_ii->file_id, ia.file_id);
00599         }
00600         if (hsmfs_ii->chunk_size != ia.chunk_size) {
00601             ivd_warn("ino=%lu (%u): chunk_size mismatch -> ii=%llu, ia=%llu",
00602                      inode->i_ino, inode->i_generation,
00603                      hsmfs_ii->chunk_size, ia.chunk_size);
00604         }
00605 
00606         if (!(flags & IVD_ISEM_HELD))
00607             mutex_lock(&inode->i_mutex);
00608 
00609         ia.flags &= ~IVD_IIF_DIRTY;
00610         ivdfs_hsmattr_write(inode, &ia);
00611 
00612         hsmfs_ii->flags &= ~IVD_IIF_DIRTY;
00613         hsmfs_ii->chg_time = ivd_nul_time;
00614 
00615         if (!(flags & IVD_ISEM_HELD))
00616             mutex_unlock(&inode->i_mutex);
00617     }
00618     else {
00619         // TODO: sanity check: we may want to remove this later
00620         ivd_warn("ino=%lu (%u), file_id %llu: clean, but mark clean requested",
00621                  inode->i_ino, inode->i_generation, hsmfs_ii->file_id);
00622     }
00623 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_mark_dirty ( struct inode *  inode,
loff_t  off,
loff_t  pos,
int  flags 
)

Definition at line 494 of file ivdfs_hsmattr.c.

References ivd_inode_info_t::chg_time, ivd_hsmattr_t::chunk_size, ivd_inode_info_t::chunk_size, DBG_II_DETAIL, EIVDBUSY, ivd_hsmattr_t::file_id, ivd_inode_info_t::file_id, ivd_hsmattr_t::flags, ivd_inode_info_t::flags, hsmfs_chg_data_interval, ivd_inode_info_t::ic, ivd_dbg, ivd_ii, IVD_IIF_DIRTY, IVD_ISEM_HELD, IVD_KEEP_TIME, ivd_nul_time, ivd_warn, ivdfs_bad_cookie(), and ivd_comm_t::minor.

Referenced by ivdfs_commit_write(), ivdfs_file_aio_write(), ivdfs_file_mmap(), ivdfs_file_write(), ivdfs_trigger_event(), and ivdfs_truncate().

00494                                                                              {
00495     int ret = 0;
00496     mode_t org_mode;
00497 
00498     ivd_inode_info_t *hsmfs_ii = ivd_ii(inode);
00499 
00500     ivd_dbg(DBG_II_DETAIL, "<%u> ino=%lu (%u), flags: %i",
00501             hsmfs_ii->ic->minor, inode->i_ino, inode->i_generation, flags);
00502 
00503     if (ivdfs_bad_cookie(hsmfs_ii)) {
00504         ivd_warn("<%u> Bad HSMFS cookie for inode=%lu", hsmfs_ii->ic->minor, inode->i_ino);
00505     }
00506 
00507     if (hsmfs_ii->chg_time.tv_sec + hsmfs_chg_data_interval <= CURRENT_TIME.tv_sec) {
00508         ret++; // change time interval passed -> send event
00509     }
00510 
00511     // if dirty flag not set -> set and update hsmattr
00512     if (!(hsmfs_ii->flags & IVD_IIF_DIRTY)) {
00513         ivd_hsmattr_t ia;
00514         int ret;
00515 
00516 //#warning "Inode should have ivd inode info already set. Can we skip reading EA?"
00517 
00518         // update HSM attributes
00519         ret = ivdfs_hsmattr_read(inode, &ia);
00520 
00521         if (ret < 0) {
00522             ivd_warn("<%u> Mark ino=%lu (%u) DIRTY failed - "
00523                     "Could not get read EA (ret=%d)!",
00524             hsmfs_ii->ic->minor, inode->i_ino,
00525             inode->i_generation, ret);
00526             return -EIVDBUSY;
00527         }
00528 
00529         // TODO: sanity check: we may want to remove this later
00530         if (hsmfs_ii->file_id != ia.file_id) {
00531             ivd_warn("ino=%lu (%u): file_id mismatch -> ii=%llu, ia=%llu",
00532                      inode->i_ino, inode->i_generation,
00533                      hsmfs_ii->file_id, ia.file_id);
00534         }
00535         if (hsmfs_ii->chunk_size != ia.chunk_size) {
00536             ivd_warn("ino=%lu (%u): chunk_size mismatch -> ii=%llu, ia=%llu",
00537                      inode->i_ino, inode->i_generation,
00538                      hsmfs_ii->chunk_size, ia.chunk_size);
00539         }
00540 
00541         if (!(flags & IVD_ISEM_HELD))
00542             mutex_lock(&inode->i_mutex);
00543 
00544         ia.flags |= IVD_IIF_DIRTY;
00545 
00546         org_mode = inode->i_mode;
00547         inode->i_mode |= S_IWUSR;
00548 
00549         ivdfs_hsmattr_write(inode, &ia);
00550         inode->i_mode = org_mode;
00551 
00552         hsmfs_ii->flags |= IVD_IIF_DIRTY;
00553         hsmfs_ii->chg_time = ivd_nul_time; // Init the member. It is updated below.
00554 
00555         ret++; // dirty flag updated -> send event
00556 
00557         if (!(flags & IVD_ISEM_HELD))
00558             mutex_unlock(&inode->i_mutex);
00559     }
00560 
00561     if ( !(flags & IVD_KEEP_TIME) ) {
00562         hsmfs_ii->chg_time = CURRENT_TIME;
00563     }
00564 
00565     return ret;
00566 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_mark_offline ( struct inode *  inode,
loff_t  off,
loff_t  pos,
int  flags 
)

Definition at line 387 of file ivdfs_hsmattr.c.

References ivd_hsmattr_t::chunk_size, ivd_inode_info_t::chunk_size, EIVDBUSY, ivd_inode_info_t::file_id, ivd_hsmattr_t::file_id, ivd_hsmattr_t::flags, ivd_inode_info_t::flags, ivd_inode_info_t::ic, ivd_ii, IVD_IIF_OFFLINE, IVD_ISEM_HELD, ivd_warn, ivdfs_bad_cookie(), and ivd_comm_t::minor.

Referenced by ivdfs_data_state().

00387                                                                                {
00388     int ret = 0;
00389     ivd_inode_info_t *hsmfs_ii = ivd_ii(inode);
00390 
00391     if (ivdfs_bad_cookie(hsmfs_ii)) {
00392         ret = -EIVDBUSY;
00393         ivd_warn("<%u> Bad HSMFS cookie for inode=%lu returning RC=%d", hsmfs_ii->ic->minor, inode->i_ino, ret);
00394         return ret;
00395     }
00396 
00397     // if dirty flag not set -> set and update hsmattr
00398     if (!(hsmfs_ii->flags & IVD_IIF_OFFLINE)) {
00399         ivd_hsmattr_t ia;
00400 
00401         // update HSM attributes
00402         ret = ivdfs_hsmattr_read(inode, &ia);
00403 
00404         if ((ret < 0) || (ia.file_id == 0)) {
00405             ivd_warn("<%u> Mark ino=%lu (%u) OFFLINE failed - "
00406                 "Could not get FileID (ret=%d)!",
00407                 hsmfs_ii->ic->minor, inode->i_ino,
00408                 inode->i_generation, ret);
00409             // TODO: check if we should better return original RC if ret < 0
00410             return -EIVDBUSY;
00411         }
00412 
00413         if (!(flags & IVD_ISEM_HELD))
00414             mutex_lock(&inode->i_mutex);
00415 
00416         // TODO: sanity check: we may want to remove this later
00417         if (hsmfs_ii->file_id != ia.file_id) {
00418             ivd_warn("ino=%lu (%u): file_id mismatch -> ii=%llu, ia=%llu",
00419                      inode->i_ino, inode->i_generation,
00420                      hsmfs_ii->file_id, ia.file_id);
00421         }
00422         if (hsmfs_ii->chunk_size != ia.chunk_size) {
00423             ivd_warn("ino=%lu (%u): chunk_size mismatch -> ii=%llu, ia=%llu",
00424                      inode->i_ino, inode->i_generation,
00425                      hsmfs_ii->chunk_size, ia.chunk_size);
00426         }
00427 
00428         ia.flags |= IVD_IIF_OFFLINE;
00429         ivdfs_hsmattr_write(inode, &ia);
00430 
00431         hsmfs_ii->flags |= IVD_IIF_OFFLINE;
00432 
00433         if (!(flags & IVD_ISEM_HELD))
00434             mutex_unlock(&inode->i_mutex);
00435     }
00436     else {
00437         // TODO: sanity check: we may want to remove this later
00438         // normal when files are prolonged
00439         //ivd_warn("ino=%lu (%u): offline, but mark offline requested",
00440         //         inode->i_ino, inode->i_generation);
00441     }
00442     return ret;
00443 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_mark_online ( struct inode *  inode,
loff_t  off,
loff_t  pos,
int  flags 
)

Definition at line 446 of file ivdfs_hsmattr.c.

References ivd_hsmattr_t::chunk_size, ivd_inode_info_t::chunk_size, ivd_hsmattr_t::file_id, ivd_hsmattr_t::flags, ivd_inode_info_t::flags, ivd_inode_info_t::ic, ivd_ii, IVD_IIF_OFFLINE, IVD_ISEM_HELD, ivd_warn, ivdfs_bad_cookie(), and ivd_comm_t::minor.

Referenced by ivdfs_data_state().

00446                                                                                {
00447 
00448     ivd_inode_info_t *hsmfs_ii = ivd_ii(inode);
00449 
00450     if (ivdfs_bad_cookie(hsmfs_ii)) {
00451         ivd_warn("<%u> Bad HSMFS cookie for inode=%lu", hsmfs_ii->ic->minor, inode->i_ino);
00452         return;
00453     }
00454 
00455     if (hsmfs_ii->flags & IVD_IIF_OFFLINE) {
00456         ivd_hsmattr_t ia;
00457         int ret;
00458 
00459         // update HSM attributes
00460         ret = ivdfs_hsmattr_read(inode, &ia);
00461 
00462         if ((ret < 0) || (ia.file_id == 0)) {
00463             ivd_warn("<%u> Mark ino=%lu (%u) ONLINE failed - "
00464                     "Could not get FileID (ret=%d)!",
00465             hsmfs_ii->ic->minor, inode->i_ino,
00466             inode->i_generation, ret);
00467             return;
00468         }
00469 
00470         if (hsmfs_ii->chunk_size != ia.chunk_size) {
00471             ivd_warn("ino=%lu (%u): chunk_size mismatch -> ii=%llu, ia=%llu",
00472                      inode->i_ino, inode->i_generation,
00473                      hsmfs_ii->chunk_size, ia.chunk_size);
00474         }
00475 
00476         if (!(flags & IVD_ISEM_HELD))
00477             mutex_lock(&inode->i_mutex);
00478 
00479         ia.flags &= ~IVD_IIF_OFFLINE;
00480         ivdfs_hsmattr_write(inode, &ia);
00481 
00482         hsmfs_ii->flags &= ~IVD_IIF_OFFLINE;
00483 
00484         if (!(flags & IVD_ISEM_HELD))
00485             mutex_unlock(&inode->i_mutex);
00486     }
00487     else {
00488         // TODO: sanity check: we may want to remove this later
00489         ivd_warn("ino=%lu (%u): online, but mark online requested",
00490                  inode->i_ino, inode->i_generation);
00491     }
00492 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_mkdir ( struct inode *  dir,
struct dentry *  de,
int  mode 
)

Definition at line 258 of file ivdfs_inode.c.

References ivd_fs_t::b_op, ivd_fs_b_ops_t::d_inode, DBG_INV_IO, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_err, ivd_ii, IVD_IIF_NEW_ENTRY, ivdfs_attach(), ivdfs_evt_chg_name(), NULL, and ivd_comm_t::tgid.

Referenced by ivdfs_set_d_inode_ops().

00259 {
00260     ivd_comm_t *ic = ivd_ii(dir)->ic;
00261     int ret = -ENOSYS;
00262 
00263     ivd_dbg(DBG_VFS, "dir=%lu (%u), name=%s, mode=%#o",
00264             dir->i_ino, dir->i_generation, de->d_iname, mode);
00265 
00266     if (mode & S_ISVTX) {
00267         ivd_err("Directories with sticky bit are not supported '%s'.",
00268              de->d_iname);
00269         return -EPERM;
00270     }
00271     if (ic->fs->b_op->d_inode->mkdir) {
00272         ret = ic->fs->b_op->d_inode->mkdir(dir, de, mode);
00273     }
00274 
00275     if (ret == 0) {
00276         int setOpsRet = ivdfs_attach(ic, de->d_inode);
00277         if (setOpsRet != 0) {
00278             ivd_dbg(DBG_VFS,
00279                     "dir=%lu (%u), name=%s: Failed to hijack inode",
00280                     dir->i_ino, dir->i_generation, de->d_iname);
00281             return setOpsRet;
00282         }
00283 
00284         if (task_pgrp_nr(current) == ic->tgid) {
00285             ivd_dbg(DBG_INV_IO,
00286                 "InvIO[%d,%d]: mkdir()",
00287                 current->pid, task_pgrp_nr(current));
00288         }
00289         else {
00290             ivd_ii(de->d_inode)->flags &= ~IVD_IIF_NEW_ENTRY;
00291             (void) ivdfs_evt_chg_name(de, NULL); /* TODO: error code */
00292         }
00293     }
00294     return ret;
00295 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_mknod ( struct inode *  dir,
struct dentry *  dentry,
int  mode,
dev_t  rdev 
)

Definition at line 320 of file ivdfs_inode.c.

References ivd_fs_t::b_op, ivd_fs_b_ops_t::d_inode, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivdfs_attach().

Referenced by ivdfs_set_d_inode_ops().

00321 {
00322     ivd_comm_t *ic = ivd_ii(dir)->ic;
00323     int ret = -ENOSYS;
00324 
00325     ivd_dbg(DBG_VFS, "dir=%lu (%u), name=%s, mode=%#o, rdev=%d",
00326             dir->i_ino, dir->i_generation, dentry->d_iname, mode, rdev);
00327 
00328     if (ic->fs->b_op->d_inode->mknod) {
00329         ret = ic->fs->b_op->d_inode->mknod(dir, dentry, mode, rdev);
00330     }
00331 
00332     if (!ret) {
00333         // TODO: Do we need to attach?
00334         int setOpsRet = ivdfs_attach(ic, dentry->d_inode);
00335         if (setOpsRet != 0) {
00336             ivd_dbg(DBG_VFS,
00337                     "dir=%lu (%u), name=%s: Failed to hijack inode",
00338                     dir->i_ino, dir->i_generation, dentry->d_iname);
00339             return setOpsRet;
00340         }
00341     }
00342 
00343     return ret;
00344 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int ivdfs_parse_options ( char *  options,
char *  fs 
) [static]

Definition at line 97 of file ivdfs_mod.c.

References FSTYPE_SLEN, and min.

Referenced by ivdfs_get_sb().

00098 {
00099     char    *cc, *icc, *val;
00100 
00101     if (!options)
00102         return 1;
00103 
00104     cc = options;
00105     while (*cc != 0) {
00106         if (strncmp(cc, "hsmfstype=", 10) == 0) {
00107             icc=cc;
00108             cc += 10;
00109             val = cc;
00110             while (*cc != 0 && *cc != ',')
00111                 cc++;
00112 
00113             strncpy(fs, val, min(cc-val, FSTYPE_SLEN));
00114             fs[min(cc-val, FSTYPE_SLEN)] = 0;
00115             if (*cc == ',')
00116                 cc++;
00117 
00118             /* remove ivd specific options */
00119             memmove(icc, cc, strlen(cc)+1);
00120             cc=icc;
00121         }
00122         else { /* not ivd option - skip */
00123             while (*cc != 0 && *cc != ',')
00124                 cc++;
00125             if (*cc == ',')
00126                 cc++;
00127         }
00128     }
00129 
00130     return 1;
00131 }

Here is the caller graph for this function:

int ivdfs_permission ( struct inode *  inode,
int  mask 
)

Definition at line 854 of file ivdfs_inode.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::s_inode.

00856 {
00857     ivd_comm_t *ic = ivd_ii(inode)->ic;
00858     int ret = -ENOSYS;
00859 
00860     ivd_dbg(DBG_VFS, "ino=%lu (%u)",
00861             inode->i_ino, inode->i_generation);
00862 
00863     if (ic->fs->b_op->s_inode->permission) {
00864 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00865         ret = ic->fs->b_op->s_inode->permission(inode, mask, nd);
00866 #else
00867         ret = ic->fs->b_op->s_inode->permission(inode, mask);
00868 #endif
00869     }
00870 
00871     return ret;
00872 }

int ivdfs_prepare_write ( struct file filp,
struct page *  page,
unsigned  from,
unsigned  to 
)

Definition at line 222 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_INV_IO, DBG_VFS_PAGE, EIVDBUSY, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, HSM_CAUSE_OFFLINE, ivd_dbg, ivd_ii, ivdfs_evt_data_offl(), ivdfs_is_offline, size, and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_addrs_ops().

00225 {
00226     int ret = -ENOSYS;
00227     struct inode* inode = filp->f_dentry->d_inode;
00228     ivd_comm_t *ic = ivd_ii(inode)->ic;
00229 
00230     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), pg=%lu [%u-%u]",
00231             inode->i_ino, inode->i_generation, page->index, from, to);
00232 
00233     {
00234         loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + from;
00235         loff_t size = to - from;
00236 
00237         if (ivdfs_is_offline(inode, pos, size)) {
00238 
00239             if (task_pgrp_nr(current) == ic->tgid) {
00240                 ivd_dbg(DBG_INV_IO,
00241                     "InvIO[%d,%d]: data_offl on prepare_write(pg=%lu)",
00242                     current->pid, task_pgrp_nr(current), page->index);
00243             }
00244             else {
00245                 if (ivdfs_evt_data_offl(filp->f_dentry,
00246                     pos, size, HSM_CAUSE_OFFLINE) != 0) {
00247                     ret = -EIVDBUSY;
00248                     ivd_dbg(DBG_INV_IO, "ivdfs_prepare_write: File is still offline, returning %d", ret);
00249                     return ret;
00250                 }
00251             }
00252 
00253             /* file should be online now! */
00254         }
00255     }
00256 
00257     if (ic->fs->b_op->f_addrs->prepare_write)
00258         ret = ic->fs->b_op->f_addrs->prepare_write(filp, page, from, to);
00259 
00260     return ret;
00261 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_put_link ( struct dentry *  dentry,
struct nameidata *  nd,
void *  p 
)

Definition at line 839 of file ivdfs_inode.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::s_inode.

00840 {
00841     ivd_comm_t *ic = ivd_ii(dentry->d_inode)->ic;
00842 
00843     ivd_dbg(DBG_VFS, "ino=%lu (%u), name=%s",
00844             dentry->d_inode->i_ino, dentry->d_inode->i_generation, dentry->d_iname);
00845 
00846     if (ic->fs->b_op->s_inode->put_link) {
00847         ic->fs->b_op->s_inode->put_link(dentry, nd, p);
00848     }
00849 }

void ivdfs_put_super ( struct super_block *  sb  ) 

Definition at line 221 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_err, ivd_find_comm(), ivd_info, ivd_put_comm(), ivd_put_fs(), ivdfs_evt_umount(), ivd_comm_t::sem, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00222 {
00223     ivd_comm_t *ic;
00224 
00225     ivd_dbg(DBG_VFS, "dev=%s", sb->s_id);
00226 
00227     if (!(ic = ivd_find_comm(sb->s_dev))) {
00228         ivd_err("Cannot find comm for device %u", sb->s_dev);
00229         return;
00230     }
00231 
00232     down_write(&ic->sem);
00233 
00234     /* TODO: what to do with pending and wait-reply requests */
00235     if (ic->fs->b_op->super->put_super)
00236         ic->fs->b_op->super->put_super(sb);
00237 
00238     (void) ivdfs_evt_umount(ic, sb); /* TODO: error code */
00239 
00240     ivd_info("%s: successfully unmounted", sb->s_id);
00241 
00242     ivd_put_fs(ic->fs);
00243     ivd_put_comm(ic);
00244 
00245     up_write(&ic->sem);
00246 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_read_inode_info ( struct inode *  inode,
int  flags 
)

Definition at line 289 of file ivdfs_hsmattr.c.

References ivd_hsmattr_t::chunk_size, ivd_hsmattr_t::close_time, DBG_II, DBG_II_DETAIL, ivd_hsmattr_t::file_id, ivd_hsmattr_t::flags, ivd_dbg, ivd_ii, IVD_IIF_DIRTY, IVD_IIF_MASTER, IVD_IIF_NEW_ENTRY, IVD_IIF_OFFLINE, IVD_ISEM_HELD, ivd_nul_time, ivdfs_hsmattr_init, ivdfs_init_inode_info(), and S_ISREG.

Referenced by ivdfs_attach().

00290 {
00291     ivd_hsmattr_t ia;
00292 
00293     ivd_dbg(DBG_II_DETAIL, "<%u> ino=%lu (%u)",
00294             ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00295 
00296     ivdfs_hsmattr_init(&ia);
00297 
00298     if (ivdfs_hsmattr_read(inode, &ia) == -ENODATA) {
00299         // inode does not have HSM attributes -> probably created
00300         // before ivdfs (on bottom FS) or events lost ==>
00301         //  - mark as New Entry (ivdfs_lookup() will generate event(s))
00302         //  - initialize HSM attributes
00303 
00304         int flags2 = flags;
00305 
00306         if (!(flags & IVD_ISEM_HELD)) {
00307             ivd_dbg(DBG_II_DETAIL, "Locking i_mutex and adding IVD_ISEM_HELD to flags.");
00308             flags2 |= IVD_ISEM_HELD;
00309             mutex_lock(&inode->i_mutex);
00310         }
00311 
00312         ivd_dbg(DBG_II,
00313             "<%u> ino=%lu (%u) exists, but no EA -> handle as new entry",
00314             ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00315 
00316         ivd_ii(inode)->flags |= IVD_IIF_NEW_ENTRY;
00317 
00318         ivdfs_init_inode_info(inode, flags2);
00319 
00320         // Set WORM protection for existing files (0 < CURENT_TIME - timeout).
00321         ia.close_time = 0;
00322 
00323         // if regular file => consider it is dirty (to prevent release)
00324         if (S_ISREG(inode->i_mode)) {
00325             ivd_ii(inode)->chg_time = ivd_nul_time;
00326             if (inode->i_size) { // set to dirty if size > 0
00327                 ivd_ii(inode)->flags    |= IVD_IIF_DIRTY;
00328                 ia.flags |= IVD_IIF_DIRTY;
00329                 ivd_dbg(DBG_II_DETAIL,
00330                     "ino=%lu init hsm attrs non-empty reg file: dirty",
00331                     inode->i_ino);
00332             }
00333         }
00334 
00335         if (!(flags & IVD_ISEM_HELD))
00336             mutex_unlock(&inode->i_mutex);
00337     }
00338 
00339     ivd_ii(inode)->file_id              = ia.file_id;
00340     ivd_ii(inode)->chunk_size           = ia.chunk_size;
00341     ivd_ii(inode)->close_time.tv_sec    = ia.close_time;
00342     ivd_ii(inode)->close_time.tv_nsec   = 0;
00343 
00344     if (ia.flags & IVD_IIF_DIRTY) {
00345         ivd_ii(inode)->flags    |= IVD_IIF_DIRTY;
00346     }
00347     if (ia.flags & IVD_IIF_OFFLINE) {
00348         ivd_ii(inode)->flags    |= IVD_IIF_OFFLINE;
00349     }
00350     // Inode info contains regular data form EAs
00351     ivd_ii(inode)->flags |= IVD_IIF_MASTER;
00352 
00353     ivd_dbg(DBG_II,
00354         "returning <%u> ino=%lu (%u) id=%llu, ch_size=%llu, chg_time=%lu %s %s",
00355         ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation,
00356         ivd_ii(inode)->file_id, ivd_ii(inode)->chunk_size,
00357         ivd_ii(inode)->chg_time.tv_sec,
00358         (ivd_ii(inode)->flags & IVD_IIF_DIRTY) ? "[dirty]" : "",
00359         (ivd_ii(inode)->flags & IVD_IIF_OFFLINE) ? "[offline]" : "");
00360 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_readlink ( struct dentry *  de,
char __user *  buf,
int  buflen 
)

Definition at line 811 of file ivdfs_inode.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::s_inode.

00812 {
00813     ivd_comm_t *ic = ivd_ii(de->d_inode)->ic;
00814     int ret = -ENOSYS;
00815 
00816     ivd_dbg(DBG_VFS, "ino=%lu (%u), name=%s",
00817             de->d_inode->i_ino, de->d_inode->i_generation, de->d_iname);
00818 
00819     if (ic->fs->b_op->s_inode->readlink) {
00820         ret = ic->fs->b_op->s_inode->readlink(de, buf, buflen);
00821     }
00822 
00823     return ret;
00824 }

int ivdfs_readpage ( struct file filp,
struct page *  page 
)

Definition at line 53 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_INV_IO, DBG_VFS_PAGE, EIVDBUSY, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, HSM_CAUSE_OFFLINE, ivd_dbg, ivd_ii, ivdfs_evt_data_offl(), ivdfs_is_offline, and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_addrs_ops().

00054 {
00055     int ret = 0;
00056     struct inode *inode = filp->f_dentry->d_inode;
00057     ivd_comm_t *ic = ivd_ii(inode)->ic;
00058 
00059     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), pg=%lu",
00060             inode->i_ino, inode->i_generation, page->index);
00061 
00062     {
00063         loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT);
00064 
00065         if (ivdfs_is_offline(inode, pos, PAGE_CACHE_SIZE)) {
00066 
00067             if (task_pgrp_nr(current) == ic->tgid) {
00068                 ivd_dbg(DBG_INV_IO,
00069                     "InvIO[%d,%d]: data_offl on readpage(pg=%lu)",
00070                     current->pid, task_pgrp_nr(current), page->index);
00071             }
00072             else {
00073                 /* NOTE: readpage() is called with page lock
00074                  * in function do_generic_mapping_read (filemap.c). */
00075 
00076                 unlock_page(page);
00077 
00078                 if (ivdfs_evt_data_offl(filp->f_dentry,
00079                     pos, PAGE_CACHE_SIZE, HSM_CAUSE_OFFLINE) != 0) {
00080                     /* page is already unlocked - just return error */
00081                     ret = -EIVDBUSY;
00082                     ivd_dbg(DBG_VFS_PAGE,
00083                         "ivdfs_readpage: page is still offline, returning %d", ret);
00084                 }
00085 
00086                 /* re-acquire exclusive lock of page */
00087                 lock_page(page);
00088                 if (ret)
00089                 {
00090                     SetPageError(page);
00091                     unlock_page(page);
00092                     return ret;
00093                 }
00094 
00095                 if (PageUptodate(page)) {
00096                     unlock_page(page);
00097                     return 0;
00098                 }
00099             }
00100             /* file is online now */
00101         }
00102     }
00103 
00104     if (ic->fs->b_op->f_addrs->readpage)
00105         ret = ic->fs->b_op->f_addrs->readpage(filp, page);
00106     else
00107         ret = -ENOSYS;
00108 
00109     return ret;
00110 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_readpages ( struct file filp,
struct address_space *  mapping,
struct list_head *  pages,
unsigned  nr_pages 
)

Definition at line 113 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_EVT, DBG_INV_IO, DBG_VFS_PAGE, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, HSM_CAUSE_OFFLINE, ivd_inode_info_t::ic, ivd_dbg, ivd_ii, ivdfs_evt_data_offl(), ivdfs_is_offline, and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_addrs_ops().

00116 {
00117     int ret = -ENOSYS;
00118     struct inode* inode = mapping->host;
00119     ivd_inode_info_t *ii = ivd_ii(inode);
00120     ivd_comm_t *ic = ii->ic;
00121     loff_t filesize = i_size_read(inode);
00122 
00123     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), #pages=%u",
00124             inode->i_ino, inode->i_generation, nr_pages);
00125 
00126     if (ivdfs_is_offline(inode, 0, filesize)) {
00127 
00128         ivd_dbg(DBG_EVT, "ino=%lu (%u), handling offline file, size: %lld",
00129             inode->i_ino, inode->i_generation, filesize);
00130 
00131         if (task_pgrp_nr(current) == ic->tgid) {
00132             ivd_dbg(DBG_INV_IO,
00133                 "InvIO[%d,%d]: data_offl on readpages(#pages=%u)",
00134                 current->pid, task_pgrp_nr(current), nr_pages);
00135         }
00136         else {
00137             ivd_dbg(DBG_INV_IO,
00138                  "InvIO else branch[%d,%d]: data_offl on readpages(#pages=%u)",
00139                  current->pid, task_pgrp_nr(current), nr_pages);
00140             /* TODO: Do we need to do any page locking/unlocking.
00141                Not as far as I have investigated (matejk). */
00142 
00143             if (ivdfs_evt_data_offl(filp->f_dentry,
00144                 0, filesize, HSM_CAUSE_OFFLINE) != 0) {
00145                     unsigned page_idx;
00146                     //ret = -EIVDBUSY;
00147                     ret = 0;  /* pages completed -->return 0 */
00148                     ivd_dbg(DBG_INV_IO, "ivdfs_readpages: File is still offline, returning %d", ret);
00149 
00150                     /* free page since request failed */
00151                     for (page_idx = 0; page_idx < nr_pages; page_idx++) {
00152                             struct page *page = list_entry(pages->prev, struct page, lru);
00153                             lock_page(page);
00154                             ivd_dbg(DBG_INV_IO, "page_idx %d of %d page* %p xflags %08lx",
00155                                                 page_idx, nr_pages, page, page->flags);
00156                             prefetchw(&page->flags);
00157                             list_del(&page->lru);
00158                             unlock_page(page);
00159 
00160                     }
00161                     goto out;
00162             }
00163         }
00164         /* file is online now */
00165     }
00166 
00167     /* The recall will already cause the pages to be read.
00168        TODO: Does it make any harm to call underlying readpages?
00169        It seems not. See function mpage_readpages (file mpage.c) */
00170 
00171     if (ic->fs->b_op->f_addrs->readpages)
00172         ret = ic->fs->b_op->f_addrs->readpages(filp, mapping, pages, nr_pages);
00173 out:
00174     /* BUGCHECK if all pages have been handled in this function or below it */
00175     BUG_ON(!list_empty(pages));
00176     return ret;
00177 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_releasepage ( struct page *  page,
gfp_t  gfp 
)

Definition at line 319 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_VFS_PAGE, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_addrs_ops().

00320 {
00321     int ret = -ENOSYS;
00322     struct inode* inode = page->mapping->host;
00323     ivd_comm_t *ic = ivd_ii(inode)->ic;
00324 
00325     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), pg=%lu",
00326             inode->i_ino, inode->i_generation, page->index);
00327 
00328     if (ic->fs->b_op->f_addrs->releasepage)
00329         ret = ic->fs->b_op->f_addrs->releasepage(page, gfp);
00330 
00331     return ret;
00332 }

Here is the caller graph for this function:

int ivdfs_remount_fs ( struct super_block *  sb,
int *  flags,
char *  data 
)

Definition at line 399 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00400 {
00401     ivd_comm_t *ic = ivd_ii(sb->s_root->d_inode)->ic;
00402 
00403     ivd_dbg(DBG_VFS, "dev=%s", sb->s_id);
00404 
00405     if (ic->fs->b_op->super->remount_fs)
00406         return ic->fs->b_op->super->remount_fs(sb, flags, data);
00407 
00408     return -1;
00409 }

Here is the caller graph for this function:

int ivdfs_rename ( struct inode *  old_dir,
struct dentry *  old_de,
struct inode *  new_dir,
struct dentry *  new_de 
)

Definition at line 347 of file ivdfs_inode.c.

References ivd_fs_t::b_op, CHECK_INODE_ACCESS_MOVE, ivd_fs_b_ops_t::d_inode, DBG_EVT_DETAIL, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, IVD_IIF_NEW_ENTRY, ivdfs_evt_chg_name(), ivd_comm_t::minor, NULL, S_ISDIR, and S_ISREG.

Referenced by ivdfs_set_d_inode_ops().

00349 {
00350     ivd_comm_t *ic = ivd_ii(old_dir)->ic;
00351     int ret = -ENOSYS;
00352 
00353     ivd_dbg(
00354         DBG_VFS,
00355         "old_dir=%lu (%u), old_name=%s, flags=0x%x, new_dir=%lu (%u), new_name=%s, flags=0x%x",
00356         old_dir->i_ino, old_dir->i_generation, old_de->d_iname, (old_de->d_inode ? ivd_ii(old_de->d_inode)->flags : 195948557),
00357         new_dir->i_ino, new_dir->i_generation, new_de->d_iname, (new_de->d_inode ? ivd_ii(new_de->d_inode)->flags : 195948557) );
00358 
00359     CHECK_INODE_ACCESS_MOVE( ic, inode, old_de, new_de, "move" )
00360 
00361     if (ic->fs->b_op->d_inode->rename) {
00362         ret = ic->fs->b_op->d_inode->rename(old_dir, old_de,
00363                                              new_dir, new_de);
00364     }
00365 
00366     if (!ret) {
00367         // TODO: limited symlink and special file support (no events generated)
00368         if (S_ISREG(old_de->d_inode->i_mode) || S_ISDIR(old_de->d_inode->i_mode)) {
00369             if ( !(ivd_ii(old_de->d_inode)->flags & IVD_IIF_NEW_ENTRY) ) {  // EAs set
00370                 (void) ivdfs_evt_chg_name(new_de, old_de); /* TODO: err code */
00371             }
00372             else {
00373                 if (new_de && old_de && new_de->d_inode                           // move over
00374                     && !(ivd_ii(new_de->d_inode)->flags & IVD_IIF_NEW_ENTRY) ) {  // EAs set
00375                     ivd_dbg(DBG_EVT_DETAIL, "<%u> Sending delete event..., ino=%lu (%u)",
00376                         ic->minor, new_de->d_inode->i_ino, new_de->d_inode->i_generation);
00377                     (void) ivdfs_evt_chg_name(NULL, new_de); /* TODO: err code */
00378 
00379                 }
00380 
00381                 // else no EAs up to now -> ignore rename and/or delete event(s)
00382             }
00383         }
00384     }
00385 
00386     return ret;
00387 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_rmdir ( struct inode *  dir,
struct dentry *  de 
)

Definition at line 298 of file ivdfs_inode.c.

References ivd_fs_t::b_op, CHECK_INODE_ACCESS, ivd_fs_b_ops_t::d_inode, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, ivdfs_evt_chg_name(), and NULL.

Referenced by ivdfs_set_d_inode_ops().

00299 {
00300     ivd_comm_t *ic = ivd_ii(dir)->ic;
00301     int ret = -ENOSYS;
00302 
00303     ivd_dbg(DBG_VFS, "dir=%lu (%u), name=%s",
00304             dir->i_ino, dir->i_generation, de->d_iname);
00305 
00306     CHECK_INODE_ACCESS( ic, de->d_inode, "rmdir" )
00307 
00308     if (ic->fs->b_op->d_inode->rmdir) {
00309         ret = ic->fs->b_op->d_inode->rmdir(dir, de);
00310     }
00311 
00312     if (!ret) {
00313         (void) ivdfs_evt_chg_name(NULL, de); /* TODO: error code */
00314     }
00315 
00316     return ret;
00317 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_set_close_time ( struct inode *  inode,
struct timespec  time 
)

Definition at line 1116 of file ivdfs_hsmattr.c.

References ivd_hsmattr_t::chunk_size, ivd_inode_info_t::chunk_size, ivd_hsmattr_t::close_time, ivd_inode_info_t::close_time, ivd_hsmattr_t::file_id, ivd_inode_info_t::file_id, ivd_inode_info_t::ic, ivd_ii, ivd_warn, and ivd_comm_t::minor.

01117 {
01118     ivd_hsmattr_t ia;
01119     int ret;
01120     ivd_inode_info_t *hsmfs_ii = ivd_ii(inode);
01121 
01122     // update HSM attributes
01123     ret = ivdfs_hsmattr_read(inode, &ia);
01124 
01125     if (ret < 0) {
01126         ivd_warn(
01127             "<%u> Mark ino=%lu (%u) SET CLOSE TIME - "
01128             "Reading EAa failed (ret=%d)!",
01129             hsmfs_ii->ic->minor, inode->i_ino,
01130             inode->i_generation, ret);
01131         return;
01132     }
01133 
01134     // TODO: sanity check: we may want to remove this later
01135     if (hsmfs_ii->file_id != ia.file_id) {
01136         ivd_warn("ino=%lu (%u): file_id mismatch -> ii=%llu, ia=%llu",
01137             inode->i_ino, inode->i_generation,
01138             hsmfs_ii->file_id, ia.file_id);
01139     }
01140     if (hsmfs_ii->chunk_size != ia.chunk_size) {
01141         ivd_warn("ino=%lu (%u): chunk_size mismatch -> ii=%llu, ia=%llu",
01142             inode->i_ino, inode->i_generation,
01143             hsmfs_ii->chunk_size, ia.chunk_size);
01144     }
01145 
01146     mutex_lock(&inode->i_mutex);
01147 
01148     hsmfs_ii->close_time = time;
01149     ia.close_time = time.tv_sec;
01150 
01151     ivdfs_hsmattr_write(inode, &ia);
01152 
01153     mutex_unlock(&inode->i_mutex);
01154 }

static void ivdfs_set_d_file_ops ( ivd_fs_t fs,
struct inode *  inode 
) [static]

Definition at line 357 of file ivdfs_filter.c.

References ivd_fs_t::b_op, ivd_fs_b_ops_t::d_file, ivd_fs_ops_t::d_file, ivd_err, ivdfs_file_ioctl(), ivd_fs_t::name, NULL, ivd_fs_t::op, and OVERRIDE.

Referenced by ivdfs_set_inode_ops().

00358 {
00359     struct file_operations *ivd_ops = &fs->op->d_file;
00360 
00361     if (fs->b_op->d_file == inode->i_fop) {    // already overriden
00362         inode->i_fop = ivd_ops;
00363         return;
00364     }
00365     else if (ivd_ops == inode->i_fop) {
00366         // already hijacked
00367         return;
00368     }
00369     else if (fs->b_op->d_file != NULL) {   // overridden, but does not match
00370         ivd_err("bottom ops mismatch for %s: now=%p, before=%p, ino=%lu (%u)",
00371                 fs->name, inode->i_fop, fs->b_op->d_file,
00372                 inode->i_ino, inode->i_generation);
00373         return;
00374     }
00375 
00376     // OK, override for the first time
00377     memcpy(ivd_ops, inode->i_fop, sizeof(*ivd_ops));// copy from bottom
00378     fs->b_op->d_file = inode->i_fop;                // save pointer to bottom
00379     inode->i_fop = ivd_ops;                         // switch to ivd ops
00380 
00381     OVERRIDE(ivd_ops, ioctl,        ivdfs_file_ioctl);
00382 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ivdfs_set_d_inode_ops ( ivd_fs_t fs,
struct inode *  inode 
) [static]

Definition at line 213 of file ivdfs_filter.c.

References ivd_fs_t::b_op, ivd_fs_b_ops_t::d_inode, ivd_fs_ops_t::d_inode, DBG_VFS_ALL, hsmfs_debug, ivd_err, ivdfs_create(), ivdfs_link(), ivdfs_lookup(), ivdfs_mkdir(), ivdfs_mknod(), ivdfs_rename(), ivdfs_rmdir(), ivdfs_setattr(), ivdfs_symlink(), ivdfs_unlink(), ivd_fs_t::name, NULL, ivd_fs_t::op, and OVERRIDE.

Referenced by ivdfs_set_inode_ops().

00214 {
00215     struct inode_operations *ivd_ops = &fs->op->d_inode;
00216 
00217     if (fs->b_op->d_inode == inode->i_op) {     // already overriden
00218         inode->i_op = ivd_ops;
00219         return;
00220     }
00221     else if (ivd_ops == inode->i_op) {
00222         // already hijacked
00223         return;
00224     }
00225     else if (fs->b_op->d_inode != NULL) {   // overridden, but does not match
00226         ivd_err("bottom ops mismatch for %s: now=%p, before=%p, ino=%lu (%u)",
00227                 fs->name, inode->i_op, fs->b_op->d_inode,
00228                 inode->i_ino, inode->i_generation);
00229         return;
00230     }
00231 
00232     // OK, override for the first time
00233     memcpy(ivd_ops, inode->i_op, sizeof(*ivd_ops)); // copy from bottom
00234     fs->b_op->d_inode = inode->i_op;                // save pointer to bottom
00235     inode->i_op = ivd_ops;                          // switch to ivd ops
00236 
00237     OVERRIDE(ivd_ops, lookup,       ivdfs_lookup);
00238     OVERRIDE(ivd_ops, create,       ivdfs_create);
00239     OVERRIDE(ivd_ops, link,         ivdfs_link);
00240     OVERRIDE(ivd_ops, unlink,       ivdfs_unlink);
00241     OVERRIDE(ivd_ops, symlink,      ivdfs_symlink);
00242     OVERRIDE(ivd_ops, mkdir,        ivdfs_mkdir);
00243     OVERRIDE(ivd_ops, rmdir,        ivdfs_rmdir);
00244     OVERRIDE(ivd_ops, mknod,        ivdfs_mknod);
00245     OVERRIDE(ivd_ops, rename,       ivdfs_rename);
00246     OVERRIDE(ivd_ops, setattr,      ivdfs_setattr);
00247 
00248 #if IVD_XATTR
00249     OVERRIDE(ivd_ops, setxattr,     ivdfs_setxattr);
00250     OVERRIDE(ivd_ops, getxattr,     ivdfs_getxattr);
00251     OVERRIDE(ivd_ops, listxattr,    ivdfs_listxattr);
00252     OVERRIDE(ivd_ops, removexattr,  ivdfs_removexattr);
00253 #else
00254 #   error "Kernel does not support extended attributes"
00255 #endif
00256 
00257 #if IVD_OVERRIDE_ALL
00258     if (hsmfs_debug & DBG_VFS_ALL) {
00259 //#warning causes oops on newer 2.6 kernels (kubuntu)
00260 //        OVERRIDE(ivd_ops, permission,      ivdfs_permission);
00261     }
00262 #endif
00263 
00264 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ivdfs_set_f_addrs_ops ( ivd_fs_t fs,
struct inode *  inode 
) [static]

Definition at line 441 of file ivdfs_filter.c.

References ivd_fs_t::b_op, DBG_VFS_ALL, ivd_fs_b_ops_t::f_addrs, ivd_fs_ops_t::f_addrs, hsmfs_debug, ivd_err, ivdfs_bmap(), ivdfs_commit_write(), ivdfs_direct_IO(), ivdfs_invalidatepage(), ivdfs_prepare_write(), ivdfs_readpage(), ivdfs_readpages(), ivdfs_releasepage(), ivdfs_set_page_dirty(), ivdfs_sync_page(), ivdfs_writepage(), ivdfs_writepages(), ivd_fs_t::name, NULL, ivd_fs_t::op, and OVERRIDE.

Referenced by ivdfs_set_inode_ops().

00442 {
00443     struct address_space_operations *ivd_ops = &fs->op->f_addrs;
00444 
00445     if (fs->b_op->f_addrs == inode->i_mapping->a_ops) {   // already overriden
00446         inode->i_mapping->a_ops = ivd_ops;
00447         return;
00448     }
00449     else if (ivd_ops == inode->i_mapping->a_ops) {
00450         // already hijacked
00451         return;
00452     }
00453     else if (fs->b_op->f_addrs != NULL) {   // overridden, but does not match
00454         ivd_err("bottom ops mismatch for %s: now=%p, before=%p, ino=%lu (%u)",
00455                 fs->name, inode->i_mapping->a_ops, fs->b_op->f_addrs,
00456                 inode->i_ino, inode->i_generation);
00457         return;
00458     }
00459 
00460     // OK, override for the first time
00461     memcpy(ivd_ops, inode->i_mapping->a_ops, sizeof(*ivd_ops));
00462     fs->b_op->f_addrs = inode->i_mapping->a_ops;    // save pointer to bottom
00463     inode->i_mapping->a_ops = ivd_ops;              // switch to ivd ops
00464 
00465     OVERRIDE(ivd_ops, readpage,        ivdfs_readpage);
00466     OVERRIDE(ivd_ops, readpages,       ivdfs_readpages);
00467     OVERRIDE(ivd_ops, prepare_write,   ivdfs_prepare_write);
00468     OVERRIDE(ivd_ops, commit_write,    ivdfs_commit_write);
00469 
00470 #if IVD_OVERRIDE_ALL
00471     if (hsmfs_debug & DBG_VFS_ALL) {
00472         OVERRIDE(ivd_ops, writepage,        ivdfs_writepage);
00473         OVERRIDE(ivd_ops, writepages,       ivdfs_writepages);
00474         OVERRIDE(ivd_ops, set_page_dirty,   ivdfs_set_page_dirty);
00475         OVERRIDE(ivd_ops, invalidatepage,   ivdfs_invalidatepage);
00476         OVERRIDE(ivd_ops, sync_page,        ivdfs_sync_page);
00477         OVERRIDE(ivd_ops, releasepage,      ivdfs_releasepage);
00478         OVERRIDE(ivd_ops, bmap,             ivdfs_bmap);
00479         OVERRIDE(ivd_ops, direct_IO,        ivdfs_direct_IO);
00480     }
00481 #endif
00482 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ivdfs_set_f_file_ops ( ivd_fs_t fs,
struct inode *  inode 
) [static]

Definition at line 385 of file ivdfs_filter.c.

References ivd_fs_t::b_op, DBG_VFS_ALL, ivd_fs_b_ops_t::f_file, ivd_fs_ops_t::f_file, hsmfs_debug, ivd_err, ivdfs_file_aio_fsync(), ivdfs_file_aio_read(), ivdfs_file_aio_write(), ivdfs_file_dir_notify(), ivdfs_file_fasync(), ivdfs_file_flock(), ivdfs_file_flush(), ivdfs_file_fsync(), ivdfs_file_get_unmapped_area(), ivdfs_file_ioctl(), ivdfs_file_lock(), ivdfs_file_mmap(), ivdfs_file_open(), ivdfs_file_read(), ivdfs_file_release(), ivdfs_file_sendpage(), ivdfs_file_write(), ivd_fs_t::name, NULL, ivd_fs_t::op, and OVERRIDE.

Referenced by ivdfs_set_inode_ops().

00386 {
00387     struct file_operations *ivd_ops = &fs->op->f_file;
00388 
00389     if (fs->b_op->f_file == inode->i_fop) {     // already overriden
00390         inode->i_fop = ivd_ops;
00391         return;
00392     }
00393     else if (ivd_ops == inode->i_fop) {
00394         // already hijacked
00395         return;
00396     }
00397     else if (fs->b_op->f_file != NULL) {   // overridden, but does not match
00398         ivd_err("bottom ops mismatch for %s: now=%p, before=%p, ino=%lu (%u)",
00399                 fs->name, inode->i_fop, fs->b_op->f_file,
00400                 inode->i_ino, inode->i_generation);
00401         return;
00402     }
00403 
00404     // OK, override for the first time
00405     memcpy(ivd_ops, inode->i_fop, sizeof(*ivd_ops));// copy from bottom
00406     fs->b_op->f_file = inode->i_fop;                // save pointer to bottom
00407     inode->i_fop = ivd_ops;                         // switch to ivd ops
00408 
00409     OVERRIDE(ivd_ops, ioctl,        ivdfs_file_ioctl);
00410     OVERRIDE(ivd_ops, open,         ivdfs_file_open);
00411     OVERRIDE(ivd_ops, release,      ivdfs_file_release);
00412     OVERRIDE(ivd_ops, write,        ivdfs_file_write);
00413     OVERRIDE(ivd_ops, read,         ivdfs_file_read);
00414     OVERRIDE(ivd_ops, aio_write,    ivdfs_file_aio_write);
00415     OVERRIDE(ivd_ops, aio_read,     ivdfs_file_aio_read);
00416 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00417     OVERRIDE(ivd_ops, writev,       ivdfs_file_writev);
00418     OVERRIDE(ivd_ops, readv,        ivdfs_file_readv);
00419 #endif
00420     OVERRIDE(ivd_ops, mmap,         ivdfs_file_mmap);
00421 
00422 #if IVD_OVERRIDE_ALL
00423     if (hsmfs_debug & DBG_VFS_ALL) {
00424         OVERRIDE(ivd_ops, fsync,             ivdfs_file_fsync);
00425         OVERRIDE(ivd_ops, fasync,            ivdfs_file_fasync);
00426         OVERRIDE(ivd_ops, aio_fsync,         ivdfs_file_aio_fsync);
00427         OVERRIDE(ivd_ops, flush,             ivdfs_file_flush);
00428         OVERRIDE(ivd_ops, lock,              ivdfs_file_lock);
00429 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00430         OVERRIDE(ivd_ops, sendfile,          ivdfs_file_sendfile);
00431 #endif
00432         OVERRIDE(ivd_ops, sendpage,          ivdfs_file_sendpage);
00433         OVERRIDE(ivd_ops, get_unmapped_area, ivdfs_file_get_unmapped_area);
00434         OVERRIDE(ivd_ops, flock,             ivdfs_file_flock);
00435         OVERRIDE(ivd_ops, dir_notify,        ivdfs_file_dir_notify);
00436     }
00437 #endif
00438 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ivdfs_set_f_inode_ops ( ivd_fs_t fs,
struct inode *  inode 
) [static]

Definition at line 266 of file ivdfs_filter.c.

References ivd_fs_t::b_op, DBG_VFS_ALL, ivd_fs_b_ops_t::f_inode, ivd_fs_ops_t::f_inode, hsmfs_debug, ivd_err, ivdfs_setattr(), ivdfs_truncate(), ivd_fs_t::name, NULL, ivd_fs_t::op, and OVERRIDE.

Referenced by ivdfs_set_inode_ops().

00267 {
00268     struct inode_operations *ivd_ops = &fs->op->f_inode;
00269 
00270     if (fs->b_op->f_inode == inode->i_op) {     // already overriden
00271         inode->i_op = ivd_ops;
00272         return;
00273     }
00274     else if (ivd_ops == inode->i_op) {
00275         // already hijacked
00276         return;
00277     }
00278     else if (fs->b_op->f_inode != NULL) {   // overridden, but does not match
00279         ivd_err("bottom ops mismatch for %s: now=%p, before=%p, ino=%lu (%u)",
00280                 fs->name, inode->i_op, fs->b_op->f_inode,
00281                 inode->i_ino, inode->i_generation);
00282         return;
00283     }
00284 
00285     // OK, override for the first time
00286     memcpy(ivd_ops, inode->i_op, sizeof(*ivd_ops)); // copy from bottom
00287     fs->b_op->f_inode = inode->i_op;                // save pointer to bottom
00288     inode->i_op = ivd_ops;                          // switch to ivd ops
00289 
00290     OVERRIDE(ivd_ops, truncate,     ivdfs_truncate);
00291     OVERRIDE(ivd_ops, setattr,      ivdfs_setattr);
00292 
00293 #if IVD_XATTR
00294     OVERRIDE(ivd_ops, setxattr,     ivdfs_setxattr);
00295     OVERRIDE(ivd_ops, getxattr,     ivdfs_getxattr);
00296     OVERRIDE(ivd_ops, listxattr,    ivdfs_listxattr);
00297     OVERRIDE(ivd_ops, removexattr,  ivdfs_removexattr);
00298 #else
00299 #   error "Kernel does not support extended attributes"
00300 #endif
00301 
00302 #if IVD_OVERRIDE_ALL
00303     if (hsmfs_debug & DBG_VFS_ALL) {
00304 //#warning causes oops on newer 2.6 kernels (kubuntu)
00305 //        OVERRIDE(ivd_ops, permission,      ivdfs_permission);
00306     }
00307 #endif
00308 
00309 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_set_fileid ( ivd_comm_t ic,
UInt64_t  id_fs,
UInt64_t  file_id,
UInt64_t  chunk_size 
)

Definition at line 678 of file ivdfs_hsmattr.c.

References ivd_hsmattr_t::chunk_size, ivd_inode_info_t::chunk_size, ivd_inode_info_t::close_time, ivd_hsmattr_t::close_time, DBG_II, DBG_LOCK, EIVDBUSY, ivd_hsmattr_t::file_id, ivd_inode_info_t::file_id, ivd_hsmattr_t::flags, ivd_inode_info_t::flags, hsmfs_iget(), ivd_inode_info_t::ic, ivd_dbg, ivd_err, IVD_FILE_GEN, IVD_FILE_INO, ivd_ii, IVD_IIF_DIRTY, ivd_warn, ivdfs_bad_cookie(), ivdfs_hsmattr_init, ivd_hsmattr_t::llOsFileId, ivd_comm_t::minor, NULL, and ivd_comm_t::sb.

Referenced by ivdfs_dev_ioctl().

00680 {
00681     int ret = 0;
00682     struct inode *inode = NULL;
00683     ivd_inode_info_t *hsmfs_ii = NULL;
00684     ivd_hsmattr_t ia;
00685 
00686     ivd_dbg(DBG_II, "<%u> ino=%u (%u), id=%llu, ch_size=%llu",
00687             ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs),
00688             file_id, chunk_size);
00689 
00690     if (!ic->sb) {
00691         ivd_err("<%u> device not mounted - ino=%u (%u)",
00692                 ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00693         return -ENODEV;
00694     }
00695 
00696     inode = hsmfs_iget(ic->sb, IVD_FILE_INO(id_fs));
00697     if (IS_ERR(inode)) {
00698         ivd_warn("<%u> inode not found - ino=%u (%u)",
00699                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00700         return PTR_ERR(inode);
00701     }
00702 
00703     if (is_bad_inode(inode)) {
00704         ivd_dbg(DBG_II,"<%u> bad inode: ino=%u (%u)",
00705                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00706         ret = -ENXIO;
00707         goto out;
00708     }
00709 
00710     if (inode->i_generation != IVD_FILE_GEN(id_fs)) {
00711         ivd_warn("<%u> invalid inode gen: ino=%u (%u)",
00712                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00713         ret = -ENXIO;
00714         goto out;
00715     }
00716 
00717     hsmfs_ii = ivd_ii(inode);
00718 
00719     if (ivdfs_bad_cookie(hsmfs_ii)) {
00720         ivd_warn("<%u> Bad HSMFS cookie for inode=%lu", ic->minor, inode->i_ino);
00721     }
00722 
00723     if (hsmfs_ii->file_id) {
00724         ivd_warn("<%u> file ID already set, ino=%lu (%u), ii=%llu: got=%llu",
00725                  ic->minor, inode->i_ino, inode->i_generation,
00726                  hsmfs_ii->file_id, file_id);
00727         ret = -EEXIST;
00728         goto out;
00729     }
00730 
00731     ret = ivdfs_hsmattr_read(inode, &ia);
00732 
00733 //#warning "Handling xattr needs a second thought."
00734 /* TODO:
00735     . Change the code in such a way that it doesn't reset
00736       IVD_IIF_NEW_ENTRY before writing xattr to disk.
00737     . Rethink when to read and when to write xattr from/to disk
00738 */
00739 
00740     if (ret < 0) {
00741         if (ret == -ENODATA) {
00742             // user.IVD xattr doesn't exist
00743             ivd_dbg(DBG_II,"<%u> Creating new EA for new entry: ino=%u (%u)",
00744                     ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
00745 
00746             ivdfs_hsmattr_init(&ia);
00747             ia.close_time = hsmfs_ii->close_time.tv_sec;
00748 
00749             if (hsmfs_ii->flags & IVD_IIF_DIRTY) {
00750                 ia.flags    |= IVD_IIF_DIRTY;
00751             }
00752         }
00753         else {
00754             ivd_warn("<%u> Mark ino=%lu (%u) SET FILE ID failed - "
00755                     "Could not get read EA (ret=%d)!",
00756             hsmfs_ii->ic->minor, inode->i_ino,
00757             inode->i_generation, ret);
00758             ret = -EIVDBUSY;
00759             goto out;
00760         }
00761     }
00762 
00763     // TODO: sanity check: we may want to remove this later
00764     if (hsmfs_ii->file_id != ia.file_id) {
00765         ivd_warn("ino=%lu (%u): file_id mismatch -> ii=%llu, ia=%llu",
00766                  inode->i_ino, inode->i_generation,
00767                  hsmfs_ii->file_id, ia.file_id);
00768     }
00769     if (hsmfs_ii->chunk_size != ia.chunk_size) {
00770         ivd_warn("ino=%lu (%u): chunk_size mismatch -> ii=%llu, ia=%llu",
00771                  inode->i_ino, inode->i_generation,
00772                  hsmfs_ii->chunk_size, ia.chunk_size);
00773     }
00774 
00775     // SMP: Called from ioctl() - no i_mutex held
00776     ivd_dbg(DBG_LOCK, "<%u> ino=%lu (%u): lock i_mutex",
00777             ic->minor, inode->i_ino, inode->i_generation);
00778 
00779     mutex_lock(&inode->i_mutex);
00780     ivd_dbg(DBG_LOCK, " i_mutex locked");
00781 
00782     // update inode info as well as hsm attributes
00783     hsmfs_ii->file_id      = ia.file_id    = file_id;
00784     hsmfs_ii->chunk_size   = ia.chunk_size = chunk_size;
00785 
00786     // removing ino set at first EA write
00787     // TODO: in future we might need this info
00788     ia.llOsFileId = 0;
00789 
00790     ivdfs_hsmattr_write(inode, &ia);
00791 
00792     // SMP: Called from ioctl() - no i_mutex held
00793     ivd_dbg(DBG_LOCK, "<%u> ino=%lu (%u): unlock i_mutex",
00794             ic->minor, inode->i_ino, inode->i_generation);
00795     mutex_unlock(&inode->i_mutex);
00796     ivd_dbg(DBG_LOCK, " i_mutex unlocked");
00797 
00798     ret = 0;
00799 
00800 out:
00801     iput(inode);
00802     return ret;
00803 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_set_inode_ops ( ivd_comm_t ic,
struct inode *  inode 
)

Definition at line 485 of file ivdfs_filter.c.

References alloc_hsmfs_inode_info(), DBG_FILTER, ivd_comm_t::fs, HSM_VIRTUAL_INODE_DIR, ivd_dbg, ivd_ii, ivdfs_set_d_file_ops(), ivdfs_set_d_inode_ops(), ivdfs_set_f_addrs_ops(), ivdfs_set_f_file_ops(), ivdfs_set_f_inode_ops(), S_ISDIR, and S_ISREG.

Referenced by ivdfs_attach(), and ivdfs_get_sb().

00486 {
00487     int ret = 0;
00488 
00489     ivd_dbg(DBG_FILTER, "ino=%lu (%u)", inode->i_ino, inode->i_generation);
00490 
00491     ret = alloc_hsmfs_inode_info(inode);
00492     if (ret != 0) {
00493         return ret;
00494     }
00495 
00496     ivd_ii(inode)->ic = ic;
00497 
00498     if (S_ISREG(inode->i_mode)) {
00499         ivdfs_set_f_inode_ops(ic->fs, inode);
00500         ivdfs_set_f_file_ops(ic->fs, inode);
00501         ivdfs_set_f_addrs_ops(ic->fs, inode);
00502     }
00503     else if (S_ISDIR(inode->i_mode)) {
00504         if ( inode->i_ino != HSM_VIRTUAL_INODE_DIR ){
00505             ivdfs_set_d_inode_ops(ic->fs, inode);
00506             ivdfs_set_d_file_ops(ic->fs, inode);
00507         }
00508         // dir: no address_space ops
00509     }
00510     else if (S_ISLNK(inode->i_mode)) {
00511         // TODO: fast symlink handling on ext2/ext3
00512         // TODO: limited symlink support (no override is done!!!)
00513         // ivdfs_set_s_inode_ops(ic->fs, inode);
00514         // symlink: no file ops
00515         // symlink: no address_space ops (not required)
00516     }
00517     else {
00518         // Limited support for Linux special files (no override is done!!!)
00519     }
00520 
00521     return 0;
00522 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_set_page_dirty ( struct page *  page  ) 

Definition at line 352 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_VFS_PAGE, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_addrs_ops().

00353 {
00354     int ret = -ENOSYS;
00355     struct inode* inode = page->mapping->host;
00356     ivd_comm_t *ic = ivd_ii(inode)->ic;
00357 
00358     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), pg=%lu",
00359             inode->i_ino, inode->i_generation, page->index);
00360 
00361     if (ic->fs->b_op->f_addrs->set_page_dirty)
00362         ret = ic->fs->b_op->f_addrs->set_page_dirty(page);
00363 
00364     return ret;
00365 }

Here is the caller graph for this function:

void ivdfs_set_super_ops ( ivd_fs_t fs,
struct super_block *  sb 
)

Definition at line 167 of file ivdfs_filter.c.

References ivd_fs_t::b_op, DBG_FILTER, DBG_VFS_ALL, hsmfs_debug, ivd_dbg, ivd_err, ivdfs_clear_inode(), ivdfs_delete_inode(), ivdfs_dirty_inode(), ivdfs_drop_inode(), ivdfs_put_super(), ivdfs_remount_fs(), ivdfs_statfs(), ivdfs_umount_begin(), ivdfs_unlockfs(), ivdfs_write_inode(), ivdfs_write_super(), ivdfs_write_super_lockfs(), ivd_fs_t::name, NULL, ivd_fs_t::op, OVERRIDE, ivd_fs_b_ops_t::super, and ivd_fs_ops_t::super.

Referenced by ivdfs_get_sb().

00168 {
00169     struct super_operations *ivd_ops = &fs->op->super;
00170 
00171     ivd_dbg(DBG_FILTER, "dev=%s", sb->s_id);
00172 
00173     if (fs->b_op->super == sb->s_op) {      // already overriden
00174         sb->s_op = ivd_ops;
00175         return;
00176     }
00177     else if (fs->b_op->super != NULL) {     // overridden, but does not match
00178         ivd_err("bottom ops mismatch for \"%s\": now=%p, before=%p, dev=%s",
00179                 fs->name, sb->s_op, fs->b_op->super,
00180                 sb->s_id);
00181         return;
00182     }
00183 
00184     // OK, override for the first time
00185     memcpy(ivd_ops, sb->s_op, sizeof(*ivd_ops));    // copy from bottom
00186     fs->b_op->super = sb->s_op;                     // save pointer to bottom
00187     sb->s_op = ivd_ops;                             // switch to ivd ops
00188 
00189     OVERRIDE(ivd_ops, clear_inode,  ivdfs_clear_inode);
00190     OVERRIDE(ivd_ops, put_super,    ivdfs_put_super);
00191     OVERRIDE(ivd_ops, dirty_inode,  ivdfs_dirty_inode);
00192 
00193 #ifdef IVD_OVERRIDE_ALL
00194     if (hsmfs_debug & DBG_VFS_ALL) {
00195         OVERRIDE(ivd_ops, write_inode,          ivdfs_write_inode);
00196 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00197         OVERRIDE(ivd_ops, read_inode,           ivdfs_read_inode);
00198         OVERRIDE(ivd_ops, put_inode,            ivdfs_put_inode);
00199 #endif
00200         OVERRIDE(ivd_ops, write_super,          ivdfs_write_super);
00201         OVERRIDE(ivd_ops, write_super_lockfs,   ivdfs_write_super_lockfs);
00202         OVERRIDE(ivd_ops, unlockfs,             ivdfs_unlockfs);
00203         OVERRIDE(ivd_ops, statfs,               ivdfs_statfs);
00204         OVERRIDE(ivd_ops, remount_fs,           ivdfs_remount_fs);
00205         OVERRIDE(ivd_ops, delete_inode,         ivdfs_delete_inode);
00206         OVERRIDE(ivd_ops, drop_inode,           ivdfs_drop_inode);
00207         OVERRIDE(ivd_ops, umount_begin,         ivdfs_umount_begin);
00208     }
00209 #endif
00210 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_setattr ( struct dentry *  de,
struct iattr *  attr 
)

Definition at line 390 of file ivdfs_inode.c.

References ivd_fs_t::b_op, CHECK_INODE_ACCESS, ivd_fs_b_ops_t::d_inode, DBG_INV_IO, DBG_VFS, EIVDBUSY, ivd_fs_b_ops_t::f_inode, ivd_comm_t::fs, HSM_CAUSE_OFFLINE, HSM_VIRTUAL_INODE_DIR, ivd_dbg, ivd_err, ivd_ii, IVD_IIF_NEW_ENTRY, ivdfs_evt_chg_attr(), ivdfs_evt_data_offl(), ivdfs_is_offline, S_ISDIR, S_ISREG, and ivd_comm_t::tgid.

Referenced by ivdfs_set_d_inode_ops(), and ivdfs_set_f_inode_ops().

00391 {
00392     int ret = -ENOSYS;
00393     struct inode* inode = de->d_inode;
00394     ivd_comm_t *ic = ivd_ii(inode)->ic;
00395 
00396     ivd_dbg(DBG_VFS, "ino=%lu (%u), what=%#x, mode=%#o",
00397             inode->i_ino, inode->i_generation, attr->ia_valid, attr->ia_mode);
00398 
00399     if ((attr->ia_valid & ATTR_MODE)
00400          && (attr->ia_mode & S_ISVTX)
00401          && (S_ISDIR(inode->i_mode))) {
00402         ivd_err("Directories with sticky bit are not supported '%s'.",
00403              de->d_iname);
00404         return -EPERM;
00405     }
00406 
00407     CHECK_INODE_ACCESS( ic, inode, "change" )
00408 
00409     if ((task_pgrp_nr(current) != ic->tgid)      // not InvIO
00410         && S_ISREG(inode->i_mode)        // regular file
00411         && (attr->ia_valid & ATTR_SIZE)  // size change
00412         && ivdfs_is_offline(inode, 0, inode->i_size)) {
00413         ivd_dbg(DBG_VFS,
00414             "predicting truncate(%llu) on offline file (ino=%lu)",
00415             attr->ia_size, inode->i_ino);
00416 
00417         /* HSM will need it in generic_file_write. */
00418         mutex_unlock(&inode->i_mutex);
00419         if (ivdfs_evt_data_offl(
00420               list_entry(inode->i_dentry.next, struct dentry, d_alias),
00421               0, attr->ia_size, HSM_CAUSE_OFFLINE) != 0) {
00422             mutex_lock(&inode->i_mutex);
00423             /* This is the whole point of premature recall attempt. */
00424             ret =  -EIVDBUSY;
00425             ivd_dbg(DBG_VFS, "ivdfs_setattr:This is the whole point of premature recall attempt - returning %d", ret);
00426             return ret;
00427         }
00428         mutex_lock(&inode->i_mutex);
00429     }
00430 
00431     if (S_ISDIR(inode->i_mode)) {
00432         if (ic->fs->b_op->d_inode->setattr) {
00433             ret = ic->fs->b_op->d_inode->setattr(de, attr);
00434         }
00435     }
00436     else {
00437         /* TODO: setattr for non-file!!! */
00438         if (ic->fs->b_op->f_inode->setattr) {
00439             ret = ic->fs->b_op->f_inode->setattr(de, attr);
00440         }
00441     }
00442 
00443     if (ret == 0
00444         && ((attr->ia_valid & (ATTR_UID | ATTR_GID | ATTR_MODE))
00445         || (attr->ia_valid & ATTR_SIZE   // or changed size to 0
00446            && !attr->ia_size))) {
00447 
00448         if (task_pgrp_nr(current) == ic->tgid) {
00449             ivd_dbg(DBG_INV_IO,
00450                 "InvIO[%d,%d]: setattr()",
00451                 current->pid, task_pgrp_nr(current));
00452         }
00453         else {
00454             // TODO: limited symlink and special files support (no events generated)
00455             // TODO: remove IS_ROOT check once we have EAs for root dir
00456             if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) {
00457 
00458                 if (!IS_ROOT(de) // No EA on Root
00459                     && (inode->i_ino != HSM_VIRTUAL_INODE_DIR )) { // Virtual dentry
00460                     if ( !(ivd_ii(inode)->flags & IVD_IIF_NEW_ENTRY) ) {  // EAs set
00461                         (void) ivdfs_evt_chg_attr(de); /* TODO: error code */
00462                     }
00463                     // else no EAs up to now -> ignore event
00464                 }
00465             }
00466         }
00467     }
00468 
00469     return ret;
00470 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_setopmode ( ivd_comm_t ic,
UInt16_t  opmode,
UInt16_t  timeout 
)

Definition at line 922 of file ivdfs_comm.c.

References HSM_OPMODE_READ_ONLY_NO_RECALL, HSM_OPMODE_REGULAR, HSM_OPMODE_WORM, ivd_alert, ivd_info, ivd_comm_t::minor, ivd_comm_t::opmode, and ivd_comm_t::worm_timeout.

Referenced by ivdfs_dev_ioctl(), and ivdfs_get_sb().

00923 {
00924     int ret = 0;
00925 
00926     switch (opmode) {
00927     case HSM_OPMODE_REGULAR:
00928         ivd_info("<%u> Switching to regular operation mode (%d -> %d).",
00929             ic->minor, ic->opmode, opmode);
00930         break;
00931     case HSM_OPMODE_WORM:
00932         ivd_info("<%u> Switching to WORM operation mode (%d -> %d)"\
00933             ", with %d sec timeout.", ic->minor, ic->opmode, opmode, timeout);
00934         break;
00935     case HSM_OPMODE_READ_ONLY_NO_RECALL:
00936         ivd_info("<%u> Switching to read-only-no-recall operation mode (%d -> %d).",
00937             ic->minor, ic->opmode, opmode);
00938         break;
00939     default:
00940         ivd_alert("[CRITICAL] Unsupported opmode %d!", opmode);
00941         ret = -EINVAL;
00942         goto out;
00943     }
00944     /* TODO: Do we need a read/write lock for ic modifications? */
00945     ic->opmode = opmode;
00946     ic->worm_timeout = timeout;
00947 
00948 out:
00949     return ret;
00950 }

Here is the caller graph for this function:

void ivdfs_slab_destroy (  ) 

Definition at line 104 of file ivdfs_super.c.

References DBG_FILTER, hsm_ii_cache_p, ivd_alert, and ivd_dbg.

Referenced by ivdfs_exit().

00104                           {
00105     int shrink = 0;
00106 
00107     ivd_dbg(DBG_FILTER, "Deallocating up slab cache...");
00108 
00109     shrink = kmem_cache_shrink(hsm_ii_cache_p);
00110 
00111     if (shrink != 0) {
00112         ivd_dbg(DBG_FILTER, "%d hsm slab object(s) removed.", shrink);
00113     }
00114     else {
00115         ivd_dbg(DBG_FILTER, "No hsm slab objects was removed.");
00116     }
00117 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00118     {
00119         bool ret =
00120 #endif
00121             kmem_cache_destroy(hsm_ii_cache_p);
00122 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00123         if (ret)
00124         {
00125             ivd_alert("[CRITICAL] hsm_ii_cache_p: not all structures were freed.");
00126             ivd_alert("[CRITICAL] Next filter start will fail!");
00127         }
00128     }
00129 #endif
00130 }

Here is the caller graph for this function:

int ivdfs_slab_init (  ) 

Definition at line 81 of file ivdfs_super.c.

References DBG_FILTER, hsm_ii_cache_p, ivd_alert, ivd_dbg, ivdfs_inode_init(), and NULL.

Referenced by ivdfs_init().

00081                       {
00082     int ret = 0;
00083 
00084     ivd_dbg(DBG_FILTER, "Setting up slab cache...");
00085     hsm_ii_cache_p = kmem_cache_create(
00086         "hsm_ii_cache", sizeof(ivd_inode_info_t),
00087         0, SLAB_HWCACHE_ALIGN, ivdfs_inode_init
00088 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
00089         , NULL
00090 #endif
00091         );
00092 
00093     if (hsm_ii_cache_p == NULL) {
00094         ivd_alert("[CRITICAL] Slab cache initialization failed.");
00095         ret = -ENOMEM;
00096     }
00097     else {
00098         ivd_dbg(DBG_FILTER, "Slab cache initialization succeded.");
00099     }
00100 
00101     return ret;
00102 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ivdfs_statfs ( struct dentry *  de,
struct kstatfs *  buf 
)

Definition at line 387 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00388 {
00389     ivd_comm_t *ic = ivd_ii(de->d_inode)->ic;
00390 
00391     ivd_dbg(DBG_VFS, "dev=%s", de->d_sb->s_id);
00392 
00393     if (ic->fs->b_op->super->statfs)
00394         return ic->fs->b_op->super->statfs(de, buf);
00395 
00396     return -1;
00397 }

Here is the caller graph for this function:

int ivdfs_symlink ( struct inode *  dir,
struct dentry *  de,
const char *  symname 
)

Definition at line 231 of file ivdfs_inode.c.

References ivd_fs_t::b_op, ivd_fs_b_ops_t::d_inode, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivdfs_attach().

Referenced by ivdfs_set_d_inode_ops().

00232 {
00233     ivd_comm_t *ic = ivd_ii(dir)->ic;
00234     int ret = -ENOSYS;
00235 
00236     ivd_dbg(DBG_VFS, "dir=%lu (%u), name=%s, symname=%s",
00237             dir->i_ino, dir->i_generation, de->d_iname, symname);
00238 
00239     if (ic->fs->b_op->d_inode->symlink) {
00240         ret = ic->fs->b_op->d_inode->symlink(dir, de, symname);
00241     }
00242 
00243     if (!ret) {
00244         // TODO: Do we need to attach?
00245         int setOpsRet = ivdfs_attach(ic, de->d_inode);
00246         if (setOpsRet != 0) {
00247             ivd_dbg(DBG_VFS,
00248                     "dir=%lu (%u), name=%s: Failed to hijack inode",
00249                     dir->i_ino, dir->i_generation, de->d_iname);
00250             return setOpsRet;
00251         }
00252     }
00253 
00254     return ret;
00255 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_sync_fs ( struct super_block *  sb,
int  wait 
)

void ivdfs_sync_page ( struct page *  page  ) 

Definition at line 307 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_VFS_PAGE, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_addrs_ops().

00308 {
00309     struct inode* inode = page->mapping->host;
00310     ivd_comm_t *ic = ivd_ii(inode)->ic;
00311 
00312     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), pg=%lu",
00313             inode->i_ino, inode->i_generation, page->index);
00314 
00315     if (ic->fs->b_op->f_addrs->sync_page)
00316         ic->fs->b_op->f_addrs->sync_page(page);
00317 }

Here is the caller graph for this function:

int ivdfs_trigger_event ( ivd_comm_t ic,
unsigned int  evt,
UInt64_t  id_fs,
UInt64_t  chunk_size,
UInt64_t  chunk_offset 
)

Definition at line 1157 of file ivdfs_hsmattr.c.

References DBG_COMM_DETAIL, DBG_EVT_DETAIL, DBG_II, DBG_II_DETAIL, HSM_CAUSE_MIGRATE, HSM_CAUSE_RECALL, HSM_EVT_CHG_DATA, HSM_EVT_DATA_OFFL, hsmfs_iget(), ivd_dbg, ivd_err, IVD_FILE_GEN, IVD_FILE_INO, ivd_ii, IVD_IIF_NEW_ENTRY, ivd_warn, ivdfs_evt_chg_attr(), ivdfs_evt_chg_data(), ivdfs_evt_data_offl(), ivdfs_evt_simulate_create(), ivdfs_is_offline, ivdfs_mark_dirty(), ivd_comm_t::minor, NULL, S_ISDIR, S_ISREG, and ivd_comm_t::sb.

Referenced by ivdfs_dev_ioctl().

01162 {
01163     int ret = 0;
01164     struct inode *inode = NULL;
01165 
01166     ivd_dbg(
01167         DBG_II_DETAIL,
01168         "<%u> ino=%u (%u), evt=%d, ch_size=%llu, ch_off=%llu",
01169         ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs), evt,
01170         chunk_size, chunk_offset);
01171 
01172     if (!ic->sb) {
01173         ivd_err("<%u> device not mounted - ino=%u (%u)",
01174                 ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
01175         return -ENODEV;
01176     }
01177 
01178     inode = hsmfs_iget(ic->sb, IVD_FILE_INO(id_fs));
01179     if (IS_ERR(inode)) {
01180         ivd_warn("<%u> inode not found - ino=%u (%u)",
01181                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
01182         return PTR_ERR(inode);
01183     }
01184 
01185     if (is_bad_inode(inode)) {
01186         ivd_dbg(DBG_II,"<%u> bad inode: ino=%u (%u)",
01187                  ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
01188         ret = -ENXIO;
01189         goto out;
01190     }
01191 
01192     switch (evt) {
01193         case HSM_EVT_DATA_OFFL:
01194             ivd_dbg(DBG_COMM_DETAIL, "<%u> trig event off-line ch_size=%llu, ch_off=%llu",
01195                 ic->minor, chunk_size, chunk_offset);
01196             if (ivdfs_is_offline(inode, chunk_size, chunck_offset)) {
01197                 ivd_dbg(DBG_EVT_DETAIL, "&inode %p", inode);
01198                 ivdfs_evt_data_offl(
01199                     list_entry(inode->i_dentry.next, struct dentry, d_alias),
01200                     chunk_offset, chunk_size, HSM_CAUSE_RECALL); // async!
01201             }
01202             else {
01203                 ivd_dbg(DBG_COMM_DETAIL,"<%u> data already online: ino=%u (%u)",
01204                     ic->minor, IVD_FILE_INO(id_fs), IVD_FILE_GEN(id_fs));
01205             }
01206             break;
01207         case HSM_EVT_CHG_DATA:
01208             if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) {
01209                 ivd_warn("<%u> trig migration on symlink and special files not supported yet!",
01210                         ic->minor);
01211                 ret = -EINVAL;
01212             }
01213             else if (S_ISDIR(inode->i_mode)
01214                      || !inode->i_size) {
01215                 if (ivd_ii(inode)->flags & IVD_IIF_NEW_ENTRY) {  // no EAs up to now
01216                     ivdfs_evt_simulate_create(list_entry(inode->i_dentry.next, struct dentry, d_alias));
01217                 }
01218                 else {
01219                     ivdfs_evt_chg_attr(list_entry(inode->i_dentry.next, struct dentry, d_alias));
01220                 }
01221             }
01222             else if (ivdfs_is_offline(inode, chunk_size, chunck_offset)) {
01223                 if (ivd_ii(inode)->flags & IVD_IIF_NEW_ENTRY) {  // no EAs up to now
01224                         // such case should not happen
01225                         ivdfs_evt_simulate_create(list_entry(inode->i_dentry.next, struct dentry, d_alias));
01226                     }
01227                 else {
01228                     ivdfs_evt_data_offl(
01229                         list_entry(inode->i_dentry.next, struct dentry, d_alias),
01230                         chunk_offset, chunk_size, HSM_CAUSE_MIGRATE); // async!
01231                 }
01232             }
01233             else {
01234                 if (ivd_ii(inode)->flags & IVD_IIF_NEW_ENTRY) {  // no EAs up to now
01235                         ivdfs_evt_simulate_create(list_entry(inode->i_dentry.next, struct dentry, d_alias));
01236                     }
01237                 else {
01238                     if (ivdfs_mark_dirty(inode, 0, 0, 0) > 0) {
01239                         ivdfs_evt_chg_data(inode, 0, inode->i_size);
01240                     }
01241                 }
01242             }
01243             break;
01244         default:
01245             ivd_warn("<%u> invalid event type - evt=%d", ic->minor, evt);
01246             ret = -EINVAL;
01247     }
01248 
01249 out:
01250     iput(inode);
01251     return ret;
01252 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_truncate ( struct inode *  inode  ) 

Definition at line 472 of file ivdfs_inode.c.

References ivd_fs_t::b_op, DBG_EVT_DETAIL, DBG_INV_IO, DBG_VFS, ivd_fs_b_ops_t::f_inode, ivd_comm_t::fs, ivd_dbg, ivd_ii, IVD_IIF_DIRTY, IVD_IIF_NEW_ENTRY, IVD_ISEM_HELD, ivd_warn, ivdfs_evt_chg_data(), ivdfs_is_dirty, ivdfs_is_offline, ivdfs_mark_clean(), ivdfs_mark_dirty(), and ivd_comm_t::tgid.

Referenced by ivdfs_set_f_inode_ops().

00473 {
00474     ivd_comm_t *ic = ivd_ii(inode)->ic;
00475 
00476     ivd_dbg(DBG_VFS, "ino=%lu (%u), size=%llu",
00477             inode->i_ino, inode->i_generation, inode->i_size);
00478 
00479     ivd_dbg(DBG_VFS,
00480             "current PID: %d, current GID: %d, ic GID %d",
00481             current->pid, task_pgrp_nr(current), ic->tgid);
00482 
00483     if (ivdfs_is_offline(inode, 0, inode->i_size)) {
00484 
00485         if (task_pgrp_nr(current) == ic->tgid) {
00486             ivd_dbg(DBG_INV_IO,
00487                 "InvIO[%d,%d]: data_offl on truncate(ino=%lu)",
00488                 current->pid, task_pgrp_nr(current), inode->i_ino);
00489         }
00490         else {
00491             /* file should be online due to previous setattr call! */
00492             ivd_warn("ino=%lu (%u) - truncate(%llu) called on offline file. Cannot fail.",
00493                 inode->i_ino, inode->i_generation, inode->i_size);
00494         }
00495     }
00496 
00497     if (ic->fs->b_op->f_inode->truncate) {
00498         ic->fs->b_op->f_inode->truncate(inode);
00499     }
00500 
00501     if (task_pgrp_nr(current) == ic->tgid) {
00502         ivd_dbg(DBG_INV_IO,
00503             "InvIO[%d,%d]: chg_data on truncate(ino=%lu)",
00504             current->pid, task_pgrp_nr(current), inode->i_ino);
00505     }
00506     else {
00507         /* SMP: i_mutex is held in truncate */
00508         if (inode->i_size) {
00509             if ( !(ivd_ii(inode)->flags & IVD_IIF_NEW_ENTRY) ) {  // EAs set
00510                 if (ivdfs_mark_dirty(inode, 0, inode->i_size, IVD_ISEM_HELD) > 0) {
00511                     (void) ivdfs_evt_chg_data(inode,
00512                         0, inode->i_size); /* TODO: err */
00513                 } else {
00514                     ivd_dbg(DBG_EVT_DETAIL, "Data change, but no event and update");
00515                 }
00516             }
00517             // else no EAs up to now -> ignore event
00518         } else {
00519             if (ivdfs_is_dirty(inode, 0 ,0)) {
00520                 if ( !(ivd_ii(inode)->flags & IVD_IIF_NEW_ENTRY) ) {  // EAs set
00521                     ivdfs_mark_clean(inode, 0, 0, IVD_ISEM_HELD);
00522                     ivd_dbg(DBG_EVT_DETAIL, "No data change, trunc to 0, set clean.");
00523                 }
00524                 else {
00525                     ivd_dbg(DBG_EVT_DETAIL, "No data change, trunc to 0, clear dirty flag in inode.");
00526                     // no EAs set -> cnange inode info only
00527                     ivd_ii(inode)->flags &= ~IVD_IIF_DIRTY;
00528                 }
00529             } else {
00530                 ivd_dbg(DBG_EVT_DETAIL, "No data change, trunc to 0, leave clean.");
00531             }
00532         }
00533     }
00534 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_umount_begin ( struct super_block *  sb  ) 

Definition at line 422 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00423 {
00424     ivd_comm_t *ic = ivd_ii(sb->s_root->d_inode)->ic;
00425 
00426     ivd_dbg(DBG_VFS, "dev=%s", sb->s_id);
00427 
00428     if (ic->fs->b_op->super->umount_begin)
00429         ic->fs->b_op->super->umount_begin(sb);
00430 }

Here is the caller graph for this function:

int ivdfs_unlink ( struct inode *  dir,
struct dentry *  de 
)

Definition at line 206 of file ivdfs_inode.c.

References ivd_fs_t::b_op, CHECK_INODE_ACCESS, ivd_fs_b_ops_t::d_inode, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, ivdfs_evt_chg_name(), NULL, S_ISDIR, and S_ISREG.

Referenced by ivdfs_set_d_inode_ops().

00207 {
00208     ivd_comm_t *ic = ivd_ii(dir)->ic;
00209     int ret = -ENOSYS;
00210 
00211     ivd_dbg(DBG_VFS, "dir=%lu (%u), name=%s",
00212             dir->i_ino, dir->i_generation, de->d_iname);
00213 
00214     CHECK_INODE_ACCESS( ic, de->d_inode, "unlink" )
00215 
00216     if (ic->fs->b_op->d_inode->unlink) {
00217         ret = ic->fs->b_op->d_inode->unlink(dir, de);
00218     }
00219 
00220     if (!ret) {
00221         // TODO: limited symlink and special file support (no events generated)
00222         if (S_ISREG(de->d_inode->i_mode) || S_ISDIR(de->d_inode->i_mode) ) {
00223             (void) ivdfs_evt_chg_name(NULL, de); /* TODO: error code */
00224         }
00225     }
00226 
00227     return ret;
00228 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ivdfs_unlockfs ( struct super_block *  sb  ) 

Definition at line 377 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00378 {
00379     ivd_comm_t *ic = ivd_ii(sb->s_root->d_inode)->ic;
00380 
00381     ivd_dbg(DBG_VFS, "dev=%s", sb->s_id);
00382 
00383     if (ic->fs->b_op->super->unlockfs)
00384         ic->fs->b_op->super->unlockfs(sb);
00385 }

Here is the caller graph for this function:

int ivdfs_write_inode ( struct inode *  inode,
int  wait 
)

Definition at line 285 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00286 {
00287     int ret = -ENOSYS;
00288 
00289     ivd_comm_t *ic = ivd_ii(inode)->ic;
00290 
00291     ivd_dbg(DBG_VFS, "ino=%lu (%u)", inode->i_ino, inode->i_generation);
00292 
00293     if (ic->fs->b_op->super->write_inode)
00294          ret = ic->fs->b_op->super->write_inode(inode, wait);
00295 
00296     return ret;
00297 }

Here is the caller graph for this function:

void ivdfs_write_inode_info ( struct inode *  inode,
int  flags 
)

Definition at line 363 of file ivdfs_hsmattr.c.

References ivd_hsmattr_t::chunk_size, ivd_hsmattr_t::close_time, DBG_II, DBG_II_DETAIL, ivd_hsmattr_t::file_id, ivd_hsmattr_t::flags, ivd_dbg, ivd_ii, and ivdfs_hsmattr_init.

00364 {
00365     ivd_hsmattr_t ia;
00366 
00367     ivd_dbg(DBG_II_DETAIL, "<%u> ino=%lu (%u)",
00368         ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation);
00369 
00370     ivdfs_hsmattr_init(&ia);
00371 
00372     ia.flags = ivd_ii(inode)->flags;
00373     ia.file_id    = ivd_ii(inode)->file_id;
00374     ia.chunk_size = ivd_ii(inode)->chunk_size;
00375     ia.close_time = ivd_ii(inode)->close_time.tv_sec;
00376 
00377     // inode lock not needed (clearing inode)
00378     ivdfs_hsmattr_write(inode, &ia);
00379 
00380     ivd_dbg(DBG_II,
00381         "returning <%u> ino=%lu (%u) id=%llu",
00382         ivd_ii(inode)->ic->minor, inode->i_ino, inode->i_generation,
00383         ia.file_id);
00384 }

void ivdfs_write_super ( struct super_block *  sb  ) 

Definition at line 357 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00358 {
00359     ivd_comm_t *ic = ivd_ii(sb->s_root->d_inode)->ic;
00360 
00361     ivd_dbg(DBG_VFS, "dev=%s", sb->s_id);
00362 
00363     if (ic->fs->b_op->super->write_super)
00364         ic->fs->b_op->super->write_super(sb);
00365 }

Here is the caller graph for this function:

void ivdfs_write_super_lockfs ( struct super_block *  sb  ) 

Definition at line 367 of file ivdfs_super.c.

References ivd_fs_t::b_op, DBG_VFS, ivd_comm_t::fs, ivd_dbg, ivd_ii, and ivd_fs_b_ops_t::super.

Referenced by ivdfs_set_super_ops().

00368 {
00369     ivd_comm_t *ic = ivd_ii(sb->s_root->d_inode)->ic;
00370 
00371     ivd_dbg(DBG_VFS, "dev=%s", sb->s_id);
00372 
00373     if (ic->fs->b_op->super->write_super_lockfs)
00374         ic->fs->b_op->super->write_super_lockfs(sb);
00375 }

Here is the caller graph for this function:

int ivdfs_writepage ( struct page *  page,
struct writeback_control *  wbc 
)

Definition at line 179 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_VFS_PAGE, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_addrs_ops().

00180 {
00181     int ret = -ENOSYS;
00182     struct inode *inode = page->mapping->host;
00183     ivd_comm_t *ic = ivd_ii(inode)->ic;
00184 
00185     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), pg=%lu, sync mode=0x%X",
00186             inode->i_ino, inode->i_generation, page->index, wbc->sync_mode);
00187 
00188     if (ic->fs->b_op->f_addrs->writepage)
00189         ret = ic->fs->b_op->f_addrs->writepage(page, wbc);
00190 
00191     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), pg=%lu page written.",
00192             inode->i_ino, inode->i_generation, page->index);
00193 
00194     /* writepage is called by pdflush kernel daemon.
00195        we don't have info about the user space process that has modified the file
00196        See Linux Kernel Development, Second Edition, Chapter 15
00197        NOTE Invisible IO can't be detected here in 2.6.
00198     */
00199 
00200     return ret;
00201 }

Here is the caller graph for this function:

int ivdfs_writepages ( struct address_space *  mapping,
struct writeback_control *  wbc 
)

Definition at line 204 of file ivdfs_addrs.c.

References ivd_fs_t::b_op, DBG_VFS_PAGE, ivd_fs_b_ops_t::f_addrs, ivd_comm_t::fs, ivd_dbg, and ivd_ii.

Referenced by ivdfs_set_f_addrs_ops().

00207 {
00208     int ret = -ENOSYS;
00209     struct inode* inode = mapping->host;
00210     ivd_comm_t *ic = ivd_ii(inode)->ic;
00211 
00212     ivd_dbg(DBG_VFS_PAGE, "ino=%lu (%u), #pages=%lu",
00213             inode->i_ino, inode->i_generation, mapping->nrpages);
00214 
00215     if (ic->fs->b_op->f_addrs->writepages)
00216         ret = ic->fs->b_op->f_addrs->writepages(mapping, wbc);
00217 
00218     return ret;
00219 }

Here is the caller graph for this function:

MODULE_AUTHOR ( ivd_COMPANY_NAME_d   ) 

MODULE_DESCRIPTION ( ivd_MODULE_DESC_d" - Version: "TO_STR(ivd_VERSION_MAJOR_d)"."TO_STR(ivd_VERSION_MINOR_d)"."TO_STR(ivd_VERSION_SYS_MAINT_REL_d)"-"TO_STR(ivd_VERSION_BUILDNUM_d)" "  ivd_VERSION_LABEL_d  ) 

module_exit ( ivdfs_exit   ) 

module_init ( ivdfs_init   ) 

MODULE_LICENSE ( "GPL"   ) 

module_param ( hsmfs_chg_data_interval  ,
uint  ,
S_IRUGO   
)

module_param ( hsmfs_path_bufsize  ,
uint  ,
S_IRUGO   
)

module_param ( hsmfs_event_alert  ,
uint  ,
S_IRUGO   
)

module_param ( hsmfs_new_on_open  ,
int  ,
S_IRUGO   
)

module_param ( hsmfs_import_delay  ,
int  ,
S_IRUGO   
)

module_param ( hsmfs_max_hsm_busy  ,
int  ,
S_IRUGO   
)

module_param ( hsmfs_max_sleep_time  ,
int  ,
S_IRUGO|  S_IWUSR 
)

module_param ( hsmfs_sleep_factor  ,
int  ,
S_IRUGO|  S_IWUSR 
)

module_param ( hsmfs_max_outstanding  ,
int  ,
S_IRUGO|  S_IWUSR 
)

module_param ( hsmfs_timeout  ,
ushort  ,
S_IRUGO   
)

module_param ( hsmfs_dev_major  ,
ushort  ,
S_IRUGO   
)

module_param ( hsmfs_debug  ,
ulong  ,
S_IRUGO|  S_IWUSR 
)

MODULE_PARM_DESC ( hsmfs_chg_data_interval  ,
"hsmfs change data event interval"   
)

MODULE_PARM_DESC ( hsmfs_path_bufsize  ,
"hsmfs buffer size for pathnames"   
)

MODULE_PARM_DESC ( hsmfs_event_alert  ,
"report event queue counters when # of events in queue passes multiple of this threshold"   
)

MODULE_PARM_DESC ( hsmfs_new_on_open  ,
"new-on-open mode"   
)

MODULE_PARM_DESC ( hsmfs_import_delay  ,
"delay in hundredth of seconds on first lookup of a file that was created in ext3 when hsmfs was not active"   
)

MODULE_PARM_DESC ( hsmfs_max_hsm_busy  ,
"seconds of HSM inactivity before hsmfs starts writing warnings"   
)

MODULE_PARM_DESC ( hsmfs_max_sleep_time  ,
"max sleep time in seconds"   
)

MODULE_PARM_DESC ( hsmfs_sleep_factor   ) 

MODULE_PARM_DESC ( hsmfs_max_outstanding  ,
"max # of outstanding requests per FS (length of the queue)"   
)

MODULE_PARM_DESC ( hsmfs_timeout  ,
"hsmfs comm timeout for synchronous requests (seconds)"   
)

MODULE_PARM_DESC ( hsmfs_dev_major  ,
"hsmfs comm device major number (0 = autoselect)"   
)

MODULE_PARM_DESC ( hsmfs_debug  ,
"Debugging flags"   
)

MODULE_VERSION ( TO_STR(ivd_VERSION_MAJOR_d)"."TO_STR(ivd_VERSION_MINOR_d)"."TO_STR(ivd_VERSION_SYS_MAINT_REL_d)"-"TO_STR(ivd_VERSION_BUILDNUM_d)" "   ) 


Variable Documentation

UInt32_t { ... } build [inherited]

Definition at line 74 of file ivdfs_mod.c.

const { ... } buildSystem [inherited]

Definition at line 78 of file ivdfs_mod.c.

const { ... } buildTime [inherited]

Definition at line 77 of file ivdfs_mod.c.

spinlock_t comm_lock = SPIN_LOCK_UNLOCKED [static]

Definition at line 52 of file ivdfs_comm.c.

Referenced by ivd_get_comm(), and ivd_put_comm().

struct kmem_cache* hsm_ii_cache_p [static]

Definition at line 115 of file ivdfs_params.c.

Referenced by ivdfs_file_release(), ivdfs_init(), and ivdfs_mark_dirty().

unsigned int hsmfs_chg_data_interval = ivdfs_CHG_DATA_INTERVAL_d

Definition at line 115 of file ivdfs_params.c.

Referenced by ivdfs_file_release(), ivdfs_init(), and ivdfs_mark_dirty().

const char* const hsmfs_cookie

hsmfs magic cookie for inode info.

Definition at line 45 of file ivdfs_params.c.

Referenced by alloc_hsmfs_inode_info(), ivdfs_bad_cookie(), and ivdfs_inode_init().

const char* const hsmfs_cookie = "hsmAMLK\0"

hsmfs magic cookie for inode info.

Definition at line 45 of file ivdfs_params.c.

Referenced by alloc_hsmfs_inode_info(), ivdfs_bad_cookie(), and ivdfs_inode_init().

unsigned long hsmfs_debug

Module parameters - can be set at insmod time.

Definition at line 49 of file ivdfs_params.c.

Referenced by ivdfs_dev_ioctl(), ivdfs_init(), ivdfs_set_d_inode_ops(), ivdfs_set_f_addrs_ops(), ivdfs_set_f_file_ops(), ivdfs_set_f_inode_ops(), and ivdfs_set_super_ops().

unsigned long hsmfs_debug = 0

Module parameters - can be set at insmod time.

Definition at line 49 of file ivdfs_params.c.

Referenced by ivdfs_dev_ioctl(), ivdfs_init(), ivdfs_set_d_inode_ops(), ivdfs_set_f_addrs_ops(), ivdfs_set_f_file_ops(), ivdfs_set_f_inode_ops(), and ivdfs_set_super_ops().

unsigned short hsmfs_dev_major

unsigned short hsmfs_dev_major = 0

unsigned int hsmfs_event_alert

Definition at line 103 of file ivdfs_params.c.

Referenced by ivdfs_comm_add_req(), and ivdfs_init().

unsigned int hsmfs_event_alert = ivdfs_EVENT_ALERT_d

Definition at line 103 of file ivdfs_params.c.

Referenced by ivdfs_comm_add_req(), and ivdfs_init().

struct file_system_type hsmfs_fstype [static]

Initial value:

 {
    owner:           THIS_MODULE,
    name:            "hsmfs",
    get_sb:          ivdfs_get_sb,
    kill_sb:         ivdfs_kill_sb,
    fs_flags:        FS_REQUIRES_DEV,
}

Definition at line 349 of file ivdfs_mod.c.

Definition at line 91 of file ivdfs_params.c.

Referenced by ivdfs_init().

int hsmfs_import_delay = ivdfs_IMPORT_DELAY_d

Definition at line 91 of file ivdfs_params.c.

Referenced by ivdfs_init().

Definition at line 85 of file ivdfs_params.c.

Referenced by ivdfs_comm_add_req(), and ivdfs_init().

int hsmfs_max_hsm_busy = ivdfs_MAX_HSM_BUSY_d

Definition at line 85 of file ivdfs_params.c.

Referenced by ivdfs_comm_add_req(), and ivdfs_init().

Definition at line 67 of file ivdfs_params.c.

Referenced by ivdfs_comm_add_req(), and ivdfs_init().

Definition at line 67 of file ivdfs_params.c.

Referenced by ivdfs_comm_add_req(), and ivdfs_init().

Definition at line 79 of file ivdfs_params.c.

Referenced by ivdfs_comm_add_req(), and ivdfs_init().

int hsmfs_max_sleep_time = ivdfs_MAX_SLEEP_TIME_d

Definition at line 79 of file ivdfs_params.c.

Referenced by ivdfs_comm_add_req(), and ivdfs_init().

Definition at line 97 of file ivdfs_params.c.

Referenced by ivdfs_file_open(), ivdfs_get_path(), ivdfs_init(), and ivdfs_lookup().

int hsmfs_new_on_open = ivdfs_NEW_ON_OPEN_FILES_d

Definition at line 97 of file ivdfs_params.c.

Referenced by ivdfs_file_open(), ivdfs_get_path(), ivdfs_init(), and ivdfs_lookup().

unsigned int hsmfs_path_bufsize

unsigned int hsmfs_path_bufsize = ivdfs_PATH_BUFSIZE_d

Definition at line 73 of file ivdfs_params.c.

Referenced by ivdfs_comm_add_req(), and ivdfs_init().

int hsmfs_sleep_factor = ivdfs_SLEEP_FACTOR_d

Definition at line 73 of file ivdfs_params.c.

Referenced by ivdfs_comm_add_req(), and ivdfs_init().

unsigned short hsmfs_timeout

Definition at line 61 of file ivdfs_params.c.

Referenced by ivd_get_comm(), ivdfs_get_sb(), and ivdfs_init().

unsigned short hsmfs_timeout = 5*60

Definition at line 61 of file ivdfs_params.c.

Referenced by ivd_get_comm(), ivdfs_get_sb(), and ivdfs_init().

ivd_comm_t ivd_comm[MAX_IVDFS] [static]

Definition at line 55 of file ivdfs_comm.c.

struct timespec ivd_nul_time

struct timespec ivd_nul_time = {0, 0}

ivd_fs_t ivd_supp_fs[] [static]

Initial value:

{
    { "ext3", 0,  IVD_BFS_NEEDS_USER_XATTR, NULL, NULL, NULL },







    { NULL,   0,  0, NULL, NULL, NULL },
}

Definition at line 54 of file ivdfs_filter.c.

struct file_operations ivdfs_dev_fops

Initial value:

 {
    .owner      = THIS_MODULE,
    .llseek     = no_llseek,
    .read       = ivdfs_dev_read,
    .write      = ivdfs_dev_write,
    .poll       = ivdfs_dev_poll,
    .ioctl      = ivdfs_dev_ioctl,
    .open       = ivdfs_dev_open,
    .release    = ivdfs_dev_release
}

Definition at line 1005 of file ivdfs_comm.c.

Referenced by ivdfs_comm_init().

struct { ... } ivdfs_vers [static]

Referenced by ivdfs_init().

const { ... } label [inherited]

Definition at line 75 of file ivdfs_mod.c.

UInt32_t { ... } major [inherited]

Definition at line 71 of file ivdfs_mod.c.

UInt32_t { ... } minor [inherited]

Definition at line 72 of file ivdfs_mod.c.

const { ... } moduleVersion [inherited]

Definition at line 76 of file ivdfs_mod.c.

UInt32_t { ... } smr [inherited]

Definition at line 73 of file ivdfs_mod.c.

spinlock_t supp_fs_lock = SPIN_LOCK_UNLOCKED [static]

Definition at line 51 of file ivdfs_filter.c.

Referenced by ivd_get_fs(), and ivd_put_fs().


Generated on Mon Feb 27 18:54:06 2012 for OPENARCHIVE by  doxygen 1.5.6