|  |  | @ -1,6 +1,7 @@ | 
			
		
	
		
			
				
					|  |  |  | package filesys | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import ( | 
			
		
	
		
			
				
					|  |  |  | 	"fmt" | 
			
		
	
		
			
				
					|  |  |  | 	"github.com/chrislusf/seaweedfs/weed/filesys/page_writer" | 
			
		
	
		
			
				
					|  |  |  | 	"github.com/chrislusf/seaweedfs/weed/glog" | 
			
		
	
		
			
				
					|  |  |  | ) | 
			
		
	
	
		
			
				
					|  |  | @ -69,22 +70,24 @@ func (pw *PageWriter) FlushData() error { | 
			
		
	
		
			
				
					|  |  |  | func (pw *PageWriter) ReadDirtyDataAt(data []byte, offset int64) (maxStop int64) { | 
			
		
	
		
			
				
					|  |  |  | 	glog.V(4).Infof("ReadDirtyDataAt %v [%d, %d)", pw.f.fullpath(), offset, offset+int64(len(data))) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	dataSlice := data | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	chunkIndex := offset / pw.chunkSize | 
			
		
	
		
			
				
					|  |  |  | 	for i := chunkIndex; len(data) > 0; i++ { | 
			
		
	
		
			
				
					|  |  |  | 		readSize := min(int64(len(data)), (i+1)*pw.chunkSize-offset) | 
			
		
	
		
			
				
					|  |  |  | 	for i := chunkIndex; len(dataSlice) > 0; i++ { | 
			
		
	
		
			
				
					|  |  |  | 		readSize := min(int64(len(dataSlice)), (i+1)*pw.chunkSize-offset) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		if pw.streamWriter != nil { | 
			
		
	
		
			
				
					|  |  |  | 			m1 := pw.streamWriter.ReadDirtyDataAt(data[:readSize], offset) | 
			
		
	
		
			
				
					|  |  |  | 			m1 := pw.streamWriter.ReadDirtyDataAt(dataSlice[:readSize], offset) | 
			
		
	
		
			
				
					|  |  |  | 			maxStop = max(maxStop, m1) | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		m2 := pw.randomWriter.ReadDirtyDataAt(data[:readSize], offset) | 
			
		
	
		
			
				
					|  |  |  | 		m2 := pw.randomWriter.ReadDirtyDataAt(dataSlice[:readSize], offset) | 
			
		
	
		
			
				
					|  |  |  | 		maxStop = max(maxStop, m2) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		offset += readSize | 
			
		
	
		
			
				
					|  |  |  | 		data = data[readSize:] | 
			
		
	
		
			
				
					|  |  |  | 		data = dataSlice[readSize:] | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	page_writer.CheckByteZero("page writer read", data, 0, maxStop-offset) | 
			
		
	
		
			
				
					|  |  |  | 	page_writer.CheckByteZero(fmt.Sprintf("page writer read [%d,%d)", offset, offset+int64(len(data))), data, 0, maxStop-offset) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	return | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
	
		
			
				
					|  |  | 
 |