Whamcloud - gitweb
b=21454 Disable cl_page_in_io check for append write.
authorJay Xiong <Jinshan.Xiong@sun.com>
Wed, 23 Dec 2009 03:18:42 +0000 (06:18 +0300)
committerMike Tappro <tappro@garden.(none)>
Wed, 23 Dec 2009 20:03:06 +0000 (23:03 +0300)
This is because for append write, it's difficult to pass the uptodate file size to subio.

i=wangdi
i=eric.mei

lustre/llite/file.c
lustre/lov/lov_io.c
lustre/obdclass/cl_io.c

index 4af77c3..cb32570 100644 (file)
@@ -805,7 +805,7 @@ void ll_io_init(struct cl_io *io, const struct file *file, int write)
         memset(io, 0, sizeof *io);
         io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK;
         if (write)
-                io->u.ci_wr.wr_append = file->f_flags & O_APPEND;
+                io->u.ci_wr.wr_append = !!(file->f_flags & O_APPEND);
         io->ci_obj     = ll_i2info(inode)->lli_clob;
         io->ci_lockreq = CILR_MAYBE;
         if (ll_file_nolock(file)) {
index 3634b4b..80bfb20 100644 (file)
@@ -118,8 +118,12 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,
         }
         case CIT_READ:
         case CIT_WRITE: {
-                io->u.ci_rw.crw_pos = start;
-                io->u.ci_rw.crw_count = end - start;
+                if (cl_io_is_append(parent)) {
+                        io->u.ci_wr.wr_append = 1;
+                } else {
+                        io->u.ci_rw.crw_pos = start;
+                        io->u.ci_rw.crw_count = end - start;
+                }
                 break;
         }
         default:
index d9c6d51..5a6b8b0 100644 (file)
@@ -657,7 +657,7 @@ cl_io_slice_page(const struct cl_io_slice *ios, struct cl_page *page)
  */
 static int cl_page_in_io(const struct cl_page *page, const struct cl_io *io)
 {
-        int     result;
+        int     result = 1;
         loff_t  start;
         loff_t  end;
         pgoff_t idx;
@@ -670,10 +670,13 @@ static int cl_page_in_io(const struct cl_page *page, const struct cl_io *io)
                  * check that [start, end) and [pos, pos + count) extents
                  * overlap.
                  */
-                start = cl_offset(page->cp_obj, idx);
-                end   = cl_offset(page->cp_obj, idx + 1);
-                result = io->u.ci_rw.crw_pos < end &&
-                        start < io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count;
+                if (!cl_io_is_append(io)) {
+                        const struct cl_io_rw_common *crw = &(io->u.ci_rw);
+                        start = cl_offset(page->cp_obj, idx);
+                        end   = cl_offset(page->cp_obj, idx + 1);
+                        result = crw->crw_pos < end &&
+                                 start < crw->crw_pos + crw->crw_count;
+                }
                 break;
         case CIT_FAULT:
                 result = io->u.ci_fault.ft_index == idx;