diff options
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/call-stub.c | 225 | ||||
-rw-r--r-- | libglusterfs/src/call-stub.h | 88 | ||||
-rw-r--r-- | libglusterfs/src/defaults.c | 103 | ||||
-rw-r--r-- | libglusterfs/src/defaults.h | 3 | ||||
-rw-r--r-- | libglusterfs/src/protocol.h | 32 | ||||
-rw-r--r-- | libglusterfs/src/xlator.h | 65 |
6 files changed, 399 insertions, 117 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 89a212807d0..bc7d556c22f 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -82,7 +82,8 @@ fop_lookup_cbk_stub (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -100,6 +101,8 @@ fop_lookup_cbk_stub (call_frame_t *frame, stub->args.lookup_cbk.buf = *buf; if (dict) stub->args.lookup_cbk.dict = dict_ref (dict); + if (postparent) + stub->args.lookup_cbk.postparent = *postparent; out: return stub; } @@ -412,7 +415,8 @@ fop_truncate_cbk_stub (call_frame_t *frame, fop_truncate_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { call_stub_t *stub = NULL; @@ -424,8 +428,10 @@ fop_truncate_cbk_stub (call_frame_t *frame, stub->args.truncate_cbk.fn = fn; stub->args.truncate_cbk.op_ret = op_ret; stub->args.truncate_cbk.op_errno = op_errno; - if (buf) - stub->args.truncate_cbk.buf = *buf; + if (prebuf) + stub->args.truncate_cbk.prebuf = *prebuf; + if (postbuf) + stub->args.truncate_cbk.postbuf = *postbuf; out: return stub; } @@ -459,7 +465,8 @@ fop_ftruncate_cbk_stub (call_frame_t *frame, fop_ftruncate_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { call_stub_t *stub = NULL; @@ -471,8 +478,10 @@ fop_ftruncate_cbk_stub (call_frame_t *frame, stub->args.ftruncate_cbk.fn = fn; stub->args.ftruncate_cbk.op_ret = op_ret; stub->args.ftruncate_cbk.op_errno = op_errno; - if (buf) - stub->args.ftruncate_cbk.buf = *buf; + if (prebuf) + stub->args.ftruncate_cbk.prebuf = *prebuf; + if (postbuf) + stub->args.ftruncate_cbk.postbuf = *postbuf; out: return stub; } @@ -595,7 +604,8 @@ fop_readlink_cbk_stub (call_frame_t *frame, fop_readlink_cbk_t fn, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { call_stub_t *stub = NULL; @@ -609,6 +619,8 @@ fop_readlink_cbk_stub (call_frame_t *frame, stub->args.readlink_cbk.op_errno = op_errno; if (path) stub->args.readlink_cbk.buf = strdup (path); + if (sbuf) + stub->args.readlink_cbk.sbuf = *sbuf; out: return stub; } @@ -644,7 +656,9 @@ fop_mknod_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -660,6 +674,10 @@ fop_mknod_cbk_stub (call_frame_t *frame, stub->args.mknod_cbk.inode = inode_ref (inode); if (buf) stub->args.mknod_cbk.buf = *buf; + if (preparent) + stub->args.mknod_cbk.preparent = *preparent; + if (postparent) + stub->args.mknod_cbk.postparent = *postparent; out: return stub; } @@ -693,7 +711,9 @@ fop_mkdir_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -709,6 +729,10 @@ fop_mkdir_cbk_stub (call_frame_t *frame, stub->args.mkdir_cbk.inode = inode_ref (inode); if (buf) stub->args.mkdir_cbk.buf = *buf; + if (preparent) + stub->args.mkdir_cbk.preparent = *preparent; + if (postparent) + stub->args.mkdir_cbk.postparent = *postparent; out: return stub; } @@ -738,7 +762,9 @@ call_stub_t * fop_unlink_cbk_stub (call_frame_t *frame, fop_unlink_cbk_t fn, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -750,6 +776,10 @@ fop_unlink_cbk_stub (call_frame_t *frame, stub->args.unlink_cbk.fn = fn; stub->args.unlink_cbk.op_ret = op_ret; stub->args.unlink_cbk.op_errno = op_errno; + if (preparent) + stub->args.unlink_cbk.preparent = *preparent; + if (postparent) + stub->args.unlink_cbk.postparent = *postparent; out: return stub; } @@ -780,7 +810,9 @@ call_stub_t * fop_rmdir_cbk_stub (call_frame_t *frame, fop_rmdir_cbk_t fn, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -792,6 +824,10 @@ fop_rmdir_cbk_stub (call_frame_t *frame, stub->args.rmdir_cbk.fn = fn; stub->args.rmdir_cbk.op_ret = op_ret; stub->args.rmdir_cbk.op_errno = op_errno; + if (preparent) + stub->args.rmdir_cbk.preparent = *preparent; + if (postparent) + stub->args.rmdir_cbk.postparent = *postparent; out: return stub; } @@ -826,7 +862,9 @@ fop_symlink_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -842,6 +880,10 @@ fop_symlink_cbk_stub (call_frame_t *frame, stub->args.symlink_cbk.inode = inode_ref (inode); if (buf) stub->args.symlink_cbk.buf = *buf; + if (preparent) + stub->args.symlink_cbk.preparent = *preparent; + if (postparent) + stub->args.symlink_cbk.postparent = *postparent; out: return stub; } @@ -875,7 +917,11 @@ fop_rename_cbk_stub (call_frame_t *frame, fop_rename_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { call_stub_t *stub = NULL; @@ -889,6 +935,14 @@ fop_rename_cbk_stub (call_frame_t *frame, stub->args.rename_cbk.op_errno = op_errno; if (buf) stub->args.rename_cbk.buf = *buf; + if (preoldparent) + stub->args.rename_cbk.preoldparent = *preoldparent; + if (postoldparent) + stub->args.rename_cbk.postoldparent = *postoldparent; + if (prenewparent) + stub->args.rename_cbk.prenewparent = *prenewparent; + if (postnewparent) + stub->args.rename_cbk.postnewparent = *postnewparent; out: return stub; } @@ -924,7 +978,9 @@ fop_link_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -940,6 +996,10 @@ fop_link_cbk_stub (call_frame_t *frame, stub->args.link_cbk.inode = inode_ref (inode); if (buf) stub->args.link_cbk.buf = *buf; + if (preparent) + stub->args.link_cbk.preparent = *preparent; + if (postparent) + stub->args.link_cbk.postparent = *postparent; out: return stub; } @@ -978,7 +1038,9 @@ fop_create_cbk_stub (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_stub_t *stub = NULL; @@ -996,6 +1058,10 @@ fop_create_cbk_stub (call_frame_t *frame, stub->args.create_cbk.inode = inode_ref (inode); if (buf) stub->args.create_cbk.buf = *buf; + if (preparent) + stub->args.create_cbk.preparent = *preparent; + if (postparent) + stub->args.create_cbk.postparent = *postparent; out: return stub; } @@ -1005,7 +1071,8 @@ call_stub_t * fop_open_stub (call_frame_t *frame, fop_open_t fn, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, + int32_t wbflags) { call_stub_t *stub = NULL; @@ -1018,6 +1085,7 @@ fop_open_stub (call_frame_t *frame, stub->args.open.fn = fn; loc_copy (&stub->args.open.loc, loc); stub->args.open.flags = flags; + stub->args.open.wbflags = wbflags; if (fd) stub->args.open.fd = fd_ref (fd); out: @@ -1140,7 +1208,8 @@ fop_writev_cbk_stub (call_frame_t *frame, fop_writev_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { call_stub_t *stub = NULL; @@ -1154,7 +1223,9 @@ fop_writev_cbk_stub (call_frame_t *frame, stub->args.writev_cbk.op_ret = op_ret; stub->args.writev_cbk.op_errno = op_errno; if (op_ret >= 0) - stub->args.writev_cbk.stbuf = *stbuf; + stub->args.writev_cbk.postbuf = *postbuf; + if (prebuf) + stub->args.writev_cbk.prebuf = *prebuf; out: return stub; } @@ -1231,8 +1302,9 @@ call_stub_t * fop_fsync_cbk_stub (call_frame_t *frame, fop_fsync_cbk_t fn, int32_t op_ret, - int32_t op_errno) - + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { call_stub_t *stub = NULL; @@ -1244,6 +1316,10 @@ fop_fsync_cbk_stub (call_frame_t *frame, stub->args.fsync_cbk.fn = fn; stub->args.fsync_cbk.op_ret = op_ret; stub->args.fsync_cbk.op_errno = op_errno; + if (prebuf) + stub->args.fsync_cbk.prebuf = *prebuf; + if (postbuf) + stub->args.fsync_cbk.postbuf = *postbuf; out: return stub; } @@ -2459,7 +2535,8 @@ call_resume_wind (call_stub_t *stub) stub->args.open.fn (stub->frame, stub->frame->this, &stub->args.open.loc, - stub->args.open.flags, stub->args.open.fd); + stub->args.open.flags, stub->args.open.fd, + stub->args.open.wbflags); break; } case GF_FOP_CREATE: @@ -2958,7 +3035,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.create_cbk.op_errno, stub->args.create_cbk.fd, stub->args.create_cbk.inode, - &stub->args.create_cbk.buf); + &stub->args.create_cbk.buf, + &stub->args.create_cbk.preparent, + &stub->args.create_cbk.postparent); else stub->args.create_cbk.fn (stub->frame, stub->frame->cookie, @@ -2967,7 +3046,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.create_cbk.op_errno, stub->args.create_cbk.fd, stub->args.create_cbk.inode, - &stub->args.create_cbk.buf); + &stub->args.create_cbk.buf, + &stub->args.create_cbk.preparent, + &stub->args.create_cbk.postparent); break; } @@ -2996,14 +3077,16 @@ call_resume_unwind (call_stub_t *stub) STACK_UNWIND (stub->frame, stub->args.readlink_cbk.op_ret, stub->args.readlink_cbk.op_errno, - stub->args.readlink_cbk.buf); + stub->args.readlink_cbk.buf, + &stub->args.readlink_cbk.sbuf); else stub->args.readlink_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.readlink_cbk.op_ret, stub->args.readlink_cbk.op_errno, - stub->args.readlink_cbk.buf); + stub->args.readlink_cbk.buf, + &stub->args.readlink_cbk.sbuf); break; } @@ -3015,7 +3098,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.mknod_cbk.op_ret, stub->args.mknod_cbk.op_errno, stub->args.mknod_cbk.inode, - &stub->args.mknod_cbk.buf); + &stub->args.mknod_cbk.buf, + &stub->args.mknod_cbk.preparent, + &stub->args.mknod_cbk.postparent); else stub->args.mknod_cbk.fn (stub->frame, stub->frame->cookie, @@ -3023,7 +3108,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.mknod_cbk.op_ret, stub->args.mknod_cbk.op_errno, stub->args.mknod_cbk.inode, - &stub->args.mknod_cbk.buf); + &stub->args.mknod_cbk.buf, + &stub->args.mknod_cbk.preparent, + &stub->args.mknod_cbk.postparent); break; } @@ -3034,7 +3121,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.mkdir_cbk.op_ret, stub->args.mkdir_cbk.op_errno, stub->args.mkdir_cbk.inode, - &stub->args.mkdir_cbk.buf); + &stub->args.mkdir_cbk.buf, + &stub->args.mkdir_cbk.preparent, + &stub->args.mkdir_cbk.postparent); else stub->args.mkdir_cbk.fn (stub->frame, stub->frame->cookie, @@ -3042,7 +3131,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.mkdir_cbk.op_ret, stub->args.mkdir_cbk.op_errno, stub->args.mkdir_cbk.inode, - &stub->args.mkdir_cbk.buf); + &stub->args.mkdir_cbk.buf, + &stub->args.mkdir_cbk.preparent, + &stub->args.mkdir_cbk.postparent); if (stub->args.mkdir_cbk.inode) inode_unref (stub->args.mkdir_cbk.inode); @@ -3055,13 +3146,17 @@ call_resume_unwind (call_stub_t *stub) if (!stub->args.unlink_cbk.fn) STACK_UNWIND (stub->frame, stub->args.unlink_cbk.op_ret, - stub->args.unlink_cbk.op_errno); + stub->args.unlink_cbk.op_errno, + &stub->args.unlink_cbk.preparent, + &stub->args.unlink_cbk.postparent); else stub->args.unlink_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.unlink_cbk.op_ret, - stub->args.unlink_cbk.op_errno); + stub->args.unlink_cbk.op_errno, + &stub->args.unlink_cbk.preparent, + &stub->args.unlink_cbk.postparent); break; } @@ -3070,13 +3165,17 @@ call_resume_unwind (call_stub_t *stub) if (!stub->args.rmdir_cbk.fn) STACK_UNWIND (stub->frame, stub->args.rmdir_cbk.op_ret, - stub->args.rmdir_cbk.op_errno); + stub->args.rmdir_cbk.op_errno, + &stub->args.rmdir_cbk.preparent, + &stub->args.rmdir_cbk.postparent); else stub->args.unlink_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.rmdir_cbk.op_ret, - stub->args.rmdir_cbk.op_errno); + stub->args.rmdir_cbk.op_errno, + &stub->args.rmdir_cbk.preparent, + &stub->args.rmdir_cbk.postparent); break; } @@ -3087,7 +3186,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.symlink_cbk.op_ret, stub->args.symlink_cbk.op_errno, stub->args.symlink_cbk.inode, - &stub->args.symlink_cbk.buf); + &stub->args.symlink_cbk.buf, + &stub->args.symlink_cbk.preparent, + &stub->args.symlink_cbk.postparent); else stub->args.symlink_cbk.fn (stub->frame, stub->frame->cookie, @@ -3095,7 +3196,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.symlink_cbk.op_ret, stub->args.symlink_cbk.op_errno, stub->args.symlink_cbk.inode, - &stub->args.symlink_cbk.buf); + &stub->args.symlink_cbk.buf, + &stub->args.symlink_cbk.preparent, + &stub->args.symlink_cbk.postparent); } break; @@ -3106,14 +3209,22 @@ call_resume_unwind (call_stub_t *stub) STACK_UNWIND (stub->frame, stub->args.rename_cbk.op_ret, stub->args.rename_cbk.op_errno, - &stub->args.rename_cbk.buf); + &stub->args.rename_cbk.buf, + &stub->args.rename_cbk.preoldparent, + &stub->args.rename_cbk.postoldparent, + &stub->args.rename_cbk.prenewparent, + &stub->args.rename_cbk.postnewparent); else stub->args.rename_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.rename_cbk.op_ret, stub->args.rename_cbk.op_errno, - &stub->args.rename_cbk.buf); + &stub->args.rename_cbk.buf, + &stub->args.rename_cbk.preoldparent, + &stub->args.rename_cbk.postoldparent, + &stub->args.rename_cbk.prenewparent, + &stub->args.rename_cbk.postnewparent); #endif break; } @@ -3133,7 +3244,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.link_cbk.op_ret, stub->args.link_cbk.op_errno, stub->args.link_cbk.inode, - &stub->args.link_cbk.buf); + &stub->args.link_cbk.buf, + &stub->args.link_cbk.preparent, + &stub->args.link_cbk.postparent); break; } @@ -3177,14 +3290,16 @@ call_resume_unwind (call_stub_t *stub) STACK_UNWIND (stub->frame, stub->args.truncate_cbk.op_ret, stub->args.truncate_cbk.op_errno, - &stub->args.truncate_cbk.buf); + &stub->args.truncate_cbk.prebuf, + &stub->args.truncate_cbk.postbuf); else stub->args.truncate_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.truncate_cbk.op_ret, stub->args.truncate_cbk.op_errno, - &stub->args.truncate_cbk.buf); + &stub->args.truncate_cbk.prebuf, + &stub->args.truncate_cbk.postbuf); break; } @@ -3217,14 +3332,16 @@ call_resume_unwind (call_stub_t *stub) STACK_UNWIND (stub->frame, stub->args.writev_cbk.op_ret, stub->args.writev_cbk.op_errno, - &stub->args.writev_cbk.stbuf); + &stub->args.writev_cbk.prebuf, + &stub->args.writev_cbk.postbuf); else stub->args.writev_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.writev_cbk.op_ret, stub->args.writev_cbk.op_errno, - &stub->args.writev_cbk.stbuf); + &stub->args.writev_cbk.prebuf, + &stub->args.writev_cbk.postbuf); break; } @@ -3266,13 +3383,17 @@ call_resume_unwind (call_stub_t *stub) if (!stub->args.fsync_cbk.fn) STACK_UNWIND (stub->frame, stub->args.fsync_cbk.op_ret, - stub->args.fsync_cbk.op_errno); + stub->args.fsync_cbk.op_errno, + &stub->args.fsync_cbk.prebuf, + &stub->args.fsync_cbk.postbuf); else stub->args.fsync_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.fsync_cbk.op_ret, - stub->args.fsync_cbk.op_errno); + stub->args.fsync_cbk.op_errno, + &stub->args.fsync_cbk.prebuf, + &stub->args.fsync_cbk.postbuf); break; } @@ -3433,14 +3554,16 @@ call_resume_unwind (call_stub_t *stub) STACK_UNWIND (stub->frame, stub->args.ftruncate_cbk.op_ret, stub->args.ftruncate_cbk.op_errno, - &stub->args.ftruncate_cbk.buf); + &stub->args.ftruncate_cbk.prebuf, + &stub->args.ftruncate_cbk.postbuf); else stub->args.ftruncate_cbk.fn (stub->frame, stub->frame->cookie, stub->frame->this, stub->args.ftruncate_cbk.op_ret, stub->args.ftruncate_cbk.op_errno, - &stub->args.ftruncate_cbk.buf); + &stub->args.ftruncate_cbk.prebuf, + &stub->args.ftruncate_cbk.postbuf); break; } @@ -3605,7 +3728,8 @@ call_resume_unwind (call_stub_t *stub) stub->args.lookup_cbk.op_errno, stub->args.lookup_cbk.inode, &stub->args.lookup_cbk.buf, - stub->args.lookup_cbk.dict); + stub->args.lookup_cbk.dict, + &stub->args.lookup_cbk.postparent); else stub->args.lookup_cbk.fn (stub->frame, stub->frame->cookie, @@ -3613,8 +3737,9 @@ call_resume_unwind (call_stub_t *stub) stub->args.lookup_cbk.op_ret, stub->args.lookup_cbk.op_errno, stub->args.lookup_cbk.inode, - &stub->args.lookup_cbk.buf, - stub->args.lookup_cbk.dict); + &stub->args.lookup_cbk.buf, + stub->args.lookup_cbk.dict, + &stub->args.lookup_cbk.postparent); /* FIXME NULL should not be passed */ if (stub->args.lookup_cbk.dict) diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 63439478cc4..88e26c24f72 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -48,6 +48,7 @@ typedef struct { inode_t *inode; struct stat buf; dict_t *dict; + struct stat postparent; } lookup_cbk; /* stat */ @@ -131,7 +132,8 @@ typedef struct { struct { fop_truncate_cbk_t fn; int32_t op_ret, op_errno; - struct stat buf; + struct stat prebuf; + struct stat postbuf; } truncate_cbk; /* ftruncate */ @@ -143,7 +145,8 @@ typedef struct { struct { fop_ftruncate_cbk_t fn; int32_t op_ret, op_errno; - struct stat buf; + struct stat prebuf; + struct stat postbuf; } ftruncate_cbk; /* utimens */ @@ -179,6 +182,7 @@ typedef struct { fop_readlink_cbk_t fn; int32_t op_ret, op_errno; const char *buf; + struct stat sbuf; } readlink_cbk; /* mknod */ @@ -193,6 +197,8 @@ typedef struct { int32_t op_ret, op_errno; inode_t *inode; struct stat buf; + struct stat preparent; + struct stat postparent; } mknod_cbk; /* mkdir */ @@ -206,6 +212,8 @@ typedef struct { int32_t op_ret, op_errno; inode_t *inode; struct stat buf; + struct stat preparent; + struct stat postparent; } mkdir_cbk; /* unlink */ @@ -216,6 +224,8 @@ typedef struct { struct { fop_unlink_cbk_t fn; int32_t op_ret, op_errno; + struct stat preparent; + struct stat postparent; } unlink_cbk; /* rmdir */ @@ -226,6 +236,8 @@ typedef struct { struct { fop_rmdir_cbk_t fn; int32_t op_ret, op_errno; + struct stat preparent; + struct stat postparent; } rmdir_cbk; /* symlink */ @@ -239,6 +251,8 @@ typedef struct { int32_t op_ret, op_errno; inode_t *inode; struct stat buf; + struct stat preparent; + struct stat postparent; } symlink_cbk; /* rename */ @@ -251,6 +265,10 @@ typedef struct { fop_rename_cbk_t fn; int32_t op_ret, op_errno; struct stat buf; + struct stat preoldparent; + struct stat postoldparent; + struct stat prenewparent; + struct stat postnewparent; } rename_cbk; /* link */ @@ -264,6 +282,8 @@ typedef struct { int32_t op_ret, op_errno; inode_t *inode; struct stat buf; + struct stat preparent; + struct stat postparent; } link_cbk; /* create */ @@ -280,6 +300,8 @@ typedef struct { fd_t *fd; inode_t *inode; struct stat buf; + struct stat preparent; + struct stat postparent; } create_cbk; /* open */ @@ -288,6 +310,7 @@ typedef struct { loc_t loc; int32_t flags; fd_t *fd; + int32_t wbflags; } open; struct { fop_open_cbk_t fn; @@ -324,7 +347,8 @@ typedef struct { struct { fop_writev_cbk_t fn; int32_t op_ret, op_errno; - struct stat stbuf; + struct stat prebuf; + struct stat postbuf; } writev_cbk; /* flush */ @@ -346,6 +370,8 @@ typedef struct { struct { fop_fsync_cbk_t fn; int32_t op_ret, op_errno; + struct stat prebuf; + struct stat postbuf; } fsync_cbk; /* opendir */ @@ -678,7 +704,8 @@ fop_lookup_cbk_stub (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict); + dict_t *dict, + struct stat *postparent); call_stub_t * fop_stat_stub (call_frame_t *frame, fop_stat_t fn, @@ -760,7 +787,8 @@ fop_truncate_cbk_stub (call_frame_t *frame, fop_truncate_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *prebuf, + struct stat *postbuf); call_stub_t * fop_ftruncate_stub (call_frame_t *frame, @@ -773,7 +801,8 @@ fop_ftruncate_cbk_stub (call_frame_t *frame, fop_ftruncate_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *prebuf, + struct stat *postbuf); call_stub_t * fop_utimens_stub (call_frame_t *frame, @@ -811,7 +840,8 @@ fop_readlink_cbk_stub (call_frame_t *frame, fop_readlink_cbk_t fn, int32_t op_ret, int32_t op_errno, - const char *path); + const char *path, + struct stat *buf); call_stub_t * fop_mknod_stub (call_frame_t *frame, @@ -826,7 +856,9 @@ fop_mknod_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_mkdir_stub (call_frame_t *frame, @@ -840,7 +872,9 @@ fop_mkdir_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_unlink_stub (call_frame_t *frame, @@ -851,7 +885,9 @@ call_stub_t * fop_unlink_cbk_stub (call_frame_t *frame, fop_unlink_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_rmdir_stub (call_frame_t *frame, @@ -862,7 +898,9 @@ call_stub_t * fop_rmdir_cbk_stub (call_frame_t *frame, fop_rmdir_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_symlink_stub (call_frame_t *frame, @@ -876,7 +914,9 @@ fop_symlink_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_rename_stub (call_frame_t *frame, @@ -889,7 +929,11 @@ fop_rename_cbk_stub (call_frame_t *frame, fop_rename_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent); call_stub_t * fop_link_stub (call_frame_t *frame, @@ -903,7 +947,9 @@ fop_link_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_create_stub (call_frame_t *frame, @@ -919,14 +965,17 @@ fop_create_cbk_stub (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); call_stub_t * fop_open_stub (call_frame_t *frame, fop_open_t fn, loc_t *loc, int32_t flags, - fd_t *fd); + fd_t *fd, + int32_t wbflags); call_stub_t * fop_open_cbk_stub (call_frame_t *frame, @@ -966,7 +1015,8 @@ fop_writev_cbk_stub (call_frame_t *frame, fop_writev_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct stat *stbuf); + struct stat *prebuf, + struct stat *postbuf); call_stub_t * fop_flush_stub (call_frame_t *frame, @@ -989,7 +1039,9 @@ call_stub_t * fop_fsync_cbk_stub (call_frame_t *frame, fop_fsync_cbk_t fn, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf); call_stub_t * fop_opendir_stub (call_frame_t *frame, diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index f72eca1f819..a2163010331 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -41,14 +41,16 @@ default_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, - dict); + dict, + postparent); return 0; } @@ -234,12 +236,14 @@ default_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, + postbuf); return 0; } @@ -264,12 +268,14 @@ default_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, + postbuf); return 0; } @@ -354,12 +360,14 @@ default_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *buf) { STACK_UNWIND (frame, op_ret, op_errno, - path); + path, + buf); return 0; } @@ -386,13 +394,17 @@ default_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, - buf); + buf, + preparent, + postparent); return 0; } @@ -418,13 +430,17 @@ default_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, - buf); + buf, + preparent, + postparent); return 0; } @@ -447,9 +463,11 @@ default_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); return 0; } @@ -471,11 +489,15 @@ default_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, - op_errno); + op_errno, + preparent, + postparent); return 0; } @@ -500,9 +522,12 @@ default_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno, inode, buf); + STACK_UNWIND (frame, op_ret, op_errno, inode, buf, preparent, + postparent); return 0; } @@ -527,9 +552,14 @@ default_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, buf, preoldparent, postoldparent, + prenewparent, postnewparent); return 0; } @@ -555,9 +585,12 @@ default_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno, inode, buf); + STACK_UNWIND (frame, op_ret, op_errno, inode, buf, preparent, + postparent); return 0; } @@ -584,9 +617,12 @@ default_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); + STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf, preparent, + postparent); return 0; } @@ -623,13 +659,14 @@ int32_t default_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, + int32_t wbflags) { STACK_WIND (frame, default_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -678,12 +715,14 @@ default_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - stbuf); + prebuf, + postbuf); return 0; } @@ -740,11 +779,15 @@ default_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, - op_errno); + op_errno, + prebuf, + postbuf); return 0; } diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index d8b99848683..2c167d97ed4 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -161,7 +161,8 @@ int32_t default_create (call_frame_t *frame, int32_t default_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd); + int32_t flags, fd_t *fd, + int32_t wbflags); int32_t default_readv (call_frame_t *frame, xlator_t *this, diff --git a/libglusterfs/src/protocol.h b/libglusterfs/src/protocol.h index 91b876a6ff3..59ebaf2bc08 100644 --- a/libglusterfs/src/protocol.h +++ b/libglusterfs/src/protocol.h @@ -337,6 +337,7 @@ typedef struct { char path[0]; /* NULL terminated */ } __attribute__((packed)) gf_fop_readlink_req_t; typedef struct { + struct gf_stat buf; char path[0]; /* NULL terminated */ } __attribute__((packed)) gf_fop_readlink_rsp_t; @@ -350,6 +351,8 @@ typedef struct { } __attribute__((packed)) gf_fop_mknod_req_t; typedef struct { struct gf_stat stat; + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_mknod_rsp_t; @@ -361,6 +364,8 @@ typedef struct { } __attribute__((packed)) gf_fop_mkdir_req_t; typedef struct { struct gf_stat stat; + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_mkdir_rsp_t; @@ -370,6 +375,8 @@ typedef struct { char bname[0]; /* NULL terminated */ } __attribute__((packed)) gf_fop_unlink_req_t; typedef struct { + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_unlink_rsp_t; @@ -379,6 +386,8 @@ typedef struct { char bname[0]; /* NULL terminated */ } __attribute__((packed)) gf_fop_rmdir_req_t; typedef struct { + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_rmdir_rsp_t; @@ -390,6 +399,8 @@ typedef struct { } __attribute__((packed)) gf_fop_symlink_req_t; typedef struct { struct gf_stat stat; + struct gf_stat preparent; + struct gf_stat postparent; }__attribute__((packed)) gf_fop_symlink_rsp_t; @@ -403,6 +414,10 @@ typedef struct { } __attribute__((packed)) gf_fop_rename_req_t; typedef struct { struct gf_stat stat; + struct gf_stat preoldparent; + struct gf_stat postoldparent; + struct gf_stat prenewparent; + struct gf_stat postnewparent; } __attribute__((packed)) gf_fop_rename_rsp_t; @@ -415,6 +430,8 @@ typedef struct { }__attribute__((packed)) gf_fop_link_req_t; typedef struct { struct gf_stat stat; + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_link_rsp_t; @@ -445,13 +462,15 @@ typedef struct { char path[0]; } __attribute__((packed)) gf_fop_truncate_req_t; typedef struct { - struct gf_stat stat; + struct gf_stat prestat; + struct gf_stat poststat; } __attribute__((packed)) gf_fop_truncate_rsp_t; typedef struct { uint64_t ino; uint32_t flags; + uint32_t wbflags; char path[0]; } __attribute__((packed)) gf_fop_open_req_t; typedef struct { @@ -478,7 +497,8 @@ typedef struct { uint32_t size; } __attribute__((packed)) gf_fop_write_req_t; typedef struct { - struct gf_stat stat; + struct gf_stat prestat; + struct gf_stat poststat; } __attribute__((packed)) gf_fop_write_rsp_t; @@ -504,6 +524,8 @@ typedef struct fsync_req { uint32_t data; } __attribute__((packed)) gf_fop_fsync_req_t; typedef struct { + struct gf_stat prestat; + struct gf_stat poststat; } __attribute__((packed)) gf_fop_fsync_rsp_t; @@ -636,6 +658,8 @@ typedef struct { typedef struct { struct gf_stat stat; uint64_t fd; + struct gf_stat preparent; + struct gf_stat postparent; } __attribute__((packed)) gf_fop_create_rsp_t; @@ -646,7 +670,8 @@ typedef struct { uint64_t offset; } __attribute__((packed)) gf_fop_ftruncate_req_t; typedef struct { - struct gf_stat stat; + struct gf_stat prestat; + struct gf_stat poststat; } __attribute__((packed)) gf_fop_ftruncate_rsp_t; @@ -757,6 +782,7 @@ typedef struct { } __attribute__((packed)) gf_fop_lookup_req_t; typedef struct { struct gf_stat stat; + struct gf_stat postparent; uint32_t dict_len; char dict[0]; } __attribute__((packed)) gf_fop_lookup_rsp_t; diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index afaaed4a4d8..a00d4975d92 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -172,7 +172,8 @@ typedef int32_t (*fop_lookup_cbk_t) (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr); + dict_t *xattr, + struct stat *postparent); typedef int32_t (*fop_stat_cbk_t) (call_frame_t *frame, void *cookie, @@ -221,14 +222,16 @@ typedef int32_t (*fop_truncate_cbk_t) (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *prebuf, + struct stat *postbuf); typedef int32_t (*fop_ftruncate_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *prebuf, + struct stat *postbuf); typedef int32_t (*fop_utimens_cbk_t) (call_frame_t *frame, void *cookie, @@ -248,7 +251,8 @@ typedef int32_t (*fop_readlink_cbk_t) (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path); + const char *path, + struct stat *buf); typedef int32_t (*fop_mknod_cbk_t) (call_frame_t *frame, void *cookie, @@ -256,7 +260,9 @@ typedef int32_t (*fop_mknod_cbk_t) (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_mkdir_cbk_t) (call_frame_t *frame, void *cookie, @@ -264,19 +270,25 @@ typedef int32_t (*fop_mkdir_cbk_t) (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_unlink_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_rmdir_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_symlink_cbk_t) (call_frame_t *frame, void *cookie, @@ -284,14 +296,20 @@ typedef int32_t (*fop_symlink_cbk_t) (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_rename_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent); typedef int32_t (*fop_link_cbk_t) (call_frame_t *frame, void *cookie, @@ -299,7 +317,9 @@ typedef int32_t (*fop_link_cbk_t) (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_create_cbk_t) (call_frame_t *frame, void *cookie, @@ -308,7 +328,9 @@ typedef int32_t (*fop_create_cbk_t) (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf); + struct stat *buf, + struct stat *preparent, + struct stat *postparent); typedef int32_t (*fop_open_cbk_t) (call_frame_t *frame, void *cookie, @@ -332,7 +354,8 @@ typedef int32_t (*fop_writev_cbk_t) (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf); + struct stat *prebuf, + struct stat *postbuf); typedef int32_t (*fop_flush_cbk_t) (call_frame_t *frame, void *cookie, @@ -344,7 +367,9 @@ typedef int32_t (*fop_fsync_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno); + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf); typedef int32_t (*fop_opendir_cbk_t) (call_frame_t *frame, void *cookie, @@ -593,11 +618,21 @@ typedef int32_t (*fop_create_t) (call_frame_t *frame, mode_t mode, fd_t *fd); +/* Tell subsequent writes on the fd_t to fsync after every writev fop without + * requiring a fsync fop. + */ +#define GF_OPEN_FSYNC 0x01 + +/* Tell write-behind to disable writing behind despite O_SYNC not being set. + */ +#define GF_OPEN_NOWB 0x02 + typedef int32_t (*fop_open_t) (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd); + fd_t *fd, + int32_t wbflags); typedef int32_t (*fop_readv_t) (call_frame_t *frame, xlator_t *this, |