Re: aufs3 GIT release

2013-09-17 Thread Philip Müller

Here is the aufs3-loopback.patch for 3.12-rc1.

greez

Phil

On 09/15/2013 09:15 PM, sf...@users.sourceforge.net wrote:

o news
- a new branch aufs3.11 is created.
- now aufs3.x-rcN is for linux-3.12-rcN.

J. R. Okajima

--

- aufs3-linux.git#aufs3.2.aufs3.11 branch
   aufs: tiny, reduce the stack consumption

- aufs3-linux.git#aufs3.x-rcN branch
   Addition to above,
   aufs: for linux-3.12, add non-FMODE_WRITE-opened file to the list 2/2
   aufs: for linux-3.12, non-FMODE_WRITE in list 1/2, export 
__file_sb_list_add()

- aufs3-standalone.git
   ditto

- aufs-util.git
   none

--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13.
http://pubads.g.doubleclick.net/gampad/clk?id=64545871iu=/4140/ostg.clktrk


aufs3.x-rcN loopback patch

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 6e43ab0..45ed62e 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -513,7 +513,7 @@ out:
 }
 
 struct switch_request {
-	struct file *file;
+	struct file *file, *virt_file;
 	struct completion wait;
 };
 
@@ -575,7 +575,8 @@ static int loop_thread(void *data)
  * First it needs to flush existing IO, it does this by sending a magic
  * BIO down the pipe. The completion of this BIO does the actual switch.
  */
-static int loop_switch(struct loop_device *lo, struct file *file)
+static int loop_switch(struct loop_device *lo, struct file *file,
+		   struct file *virt_file)
 {
 	struct switch_request w;
 	struct bio *bio = bio_alloc(GFP_KERNEL, 0);
@@ -583,6 +584,7 @@ static int loop_switch(struct loop_device *lo, struct file *file)
 		return -ENOMEM;
 	init_completion(w.wait);
 	w.file = file;
+	w.virt_file = virt_file;
 	bio-bi_private = w;
 	bio-bi_bdev = NULL;
 	loop_make_request(lo-lo_queue, bio);
@@ -599,7 +601,7 @@ static int loop_flush(struct loop_device *lo)
 	if (!lo-lo_thread)
 		return 0;
 
-	return loop_switch(lo, NULL);
+	return loop_switch(lo, NULL, NULL);
 }
 
 /*
@@ -618,6 +620,7 @@ static void do_loop_switch(struct loop_device *lo, struct switch_request *p)
 	mapping = file-f_mapping;
 	mapping_set_gfp_mask(old_file-f_mapping, lo-old_gfp_mask);
 	lo-lo_backing_file = file;
+	lo-lo_backing_virt_file = p-virt_file;
 	lo-lo_blocksize = S_ISBLK(mapping-host-i_mode) ?
 		mapping-host-i_bdev-bd_block_size : PAGE_SIZE;
 	lo-old_gfp_mask = mapping_gfp_mask(mapping);
@@ -626,6 +629,13 @@ out:
 	complete(p-wait);
 }
 
+static struct file *loop_real_file(struct file *file)
+{
+	struct file *f = NULL;
+	if (file-f_dentry-d_sb-s_op-real_loop)
+		f = file-f_dentry-d_sb-s_op-real_loop(file);
+	return f;
+}
 
 /*
  * loop_change_fd switched the backing store of a loopback device to
@@ -639,6 +649,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
 			  unsigned int arg)
 {
 	struct file	*file, *old_file;
+	struct file	*f, *virt_file = NULL, *old_virt_file;
 	struct inode	*inode;
 	int		error;
 
@@ -655,9 +666,16 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
 	file = fget(arg);
 	if (!file)
 		goto out;
+	f = loop_real_file(file);
+	if (f) {
+		virt_file = file;
+		file = f;
+		get_file(file);
+	}
 
 	inode = file-f_mapping-host;
 	old_file = lo-lo_backing_file;
+	old_virt_file = lo-lo_backing_virt_file;
 
 	error = -EINVAL;
 
@@ -669,17 +687,21 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
 		goto out_putf;
 
 	/* and ... switch */
-	error = loop_switch(lo, file);
+	error = loop_switch(lo, file, virt_file);
 	if (error)
 		goto out_putf;
 
 	fput(old_file);
+	if (old_virt_file)
+		fput(old_virt_file);
 	if (lo-lo_flags  LO_FLAGS_PARTSCAN)
 		ioctl_by_bdev(bdev, BLKRRPART, 0);
 	return 0;
 
  out_putf:
 	fput(file);
+	if (virt_file)
+		fput(virt_file);
  out:
 	return error;
 }
@@ -840,7 +862,7 @@ static void loop_config_discard(struct loop_device *lo)
 static int loop_set_fd(struct loop_device *lo, fmode_t mode,
 		   struct block_device *bdev, unsigned int arg)
 {
-	struct file	*file, *f;
+	struct file	*file, *f, *virt_file = NULL;
 	struct inode	*inode;
 	struct address_space *mapping;
 	unsigned lo_blocksize;
@@ -855,6 +877,12 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
 	file = fget(arg);
 	if (!file)
 		goto out;
+	f = loop_real_file(file);
+	if (f) {
+		virt_file = file;
+		file = f;
+		get_file(file);
+	}
 
 	error = -EBUSY;
 	if (lo-lo_state != Lo_unbound)
@@ -903,6 +931,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
 	lo-lo_device = bdev;
 	lo-lo_flags = lo_flags;
 	lo-lo_backing_file = file;
+	lo-lo_backing_virt_file = virt_file;
 	lo-transfer = 

Re: aufs3 GIT release

2013-09-17 Thread sfjro

Philip Muller:
 Here is the aufs3-loopback.patch for 3.12-rc1.

Thank you.
All aufs3-brabra.patch are generated automatically by my local script,
and I don't maintain them by GIT.
And this change is made in mainline instead of aufs work.

Anyway thanks for posting.

J. R. Okajima

PS.
I will be offline next week.

--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk